Growing tags in 2013-2014

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select top 100 *, cast(100.0 * (a.y2014 - a.y2013)/nullif(a.y2013, 0) as decimal (18, 2)) as growth_13_14  from 
( 
  select 
  t.TagName, count(distinct p.id) as postCount,   
    sum(CASE WHEN year(p.CreationDate) = 2013 THEN 1 ELSE 0 END) as y2013, 
    sum(CASE WHEN year(p.CreationDate) = 2014 THEN 1 ELSE 0 END) as y2014, 
    sum(CASE WHEN year(p.CreationDate) = 2015 THEN 1 ELSE 0 END) as y2015, 
    sum(CASE WHEN year(p.CreationDate) = 2016 THEN 1 ELSE 0 END) as y2016    
  from Posts p 
  join PostTags pTags on pTags.postId = p.id
  join Tags t on pTags.tagId = t.id
  where year(p.CreationDate) in (2013,2014, 2015, 2016)
  group by t.TagName
) as a 
where a.y2013 >= ##Min2013## AND 1.0 * a.y2014 >= 1.20 * a.y2013 and a.postCount > ##MinQuestions##
order by growth_13_14 desc

Enter Parameters

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