How is your favourite language/tag doing on SO?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Shows the trend for your favourite tag

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

-- How many posts per month for a tag?
-- Shows the trend for your favourite tag

DECLARE @TagName varchar(255) = '##TagName##'

SELECT r.PYear, r.PMonth,
       (SELECT COUNT(*)
        FROM Posts
        WHERE Posts.Tags
        LIKE '%<##TagName##>%'
        AND DATEADD(month,
                    DATEPART(month,
                             Posts.CreationDate),
                    DATEADD(year,
                            DATEPART(year,
                                     Posts.CreationDate),
                            0))
         <= DATEADD(month,r.PMonth,DATEADD(year,r.PYear, 0))) as Posts
FROM (
       SELECT DISTINCT YEAR(Posts.CreationDate) as PYear,
              MONTH(Posts.CreationDate) as PMonth
       FROM Posts
       WHERE Posts.Tags LIKE '%<##TagName##>%'
     ) AS r
GROUP BY r.Pyear, r.PMonth
ORDER BY r.PYear, r.PMonth

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results