Test

0

Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

SELECT post_year,
       post_month,
       TagName,
       month_count,
       SUM(month_count) OVER(PARTITION BY TagName
                             ORDER BY TagName
                             ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as total_count
FROM (

    SELECT datepart(year,posts.CreationDate) as post_year, 
         datepart(month,posts.CreationDate) as post_month, 
         tags.TagName , 
         COUNT(*) as month_count
  FROM PostTags as pt
    INNER JOIN POSTS as posts ON pt.PostId = posts.Id
    INNER JOIN Tags as tags ON pt.TagId = tags.Id
    WHERE tags.TagName in ('python', 'javascript')
  GROUP BY datepart(year,posts.CreationDate), 
           datepart(month,posts.CreationDate), 
           tags.TagName
           ) AS sub
GROUP BY post_year, 
         post_month, 
         TagName,
         month_count
ORDER BY post_year,
         post_month

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results