select COUNT(CASE WHEN Posts.CreationDate < '2015-02-01' ...

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
COUNT(CASE WHEN Posts.CreationDate < '2015-02-01' and Posts.CreationDate >= '2015-01-01' then 1 ELSE NULL END) as jan15,
COUNT(CASE WHEN Posts.CreationDate < '2015-03-01' and Posts.CreationDate >= '2015-02-01' then 1 ELSE NULL END) as feb15,
COUNT(CASE WHEN Posts.CreationDate < '2015-04-01' and Posts.CreationDate >= '2015-03-01' then 1 ELSE NULL END) as mar15,
COUNT(CASE WHEN Posts.CreationDate < '2015-05-01' and Posts.CreationDate >= '2015-04-01' then 1 ELSE NULL END) as apr15,
COUNT(CASE WHEN Posts.CreationDate < '2015-06-01' and Posts.CreationDate >= '2015-05-01' then 1 ELSE NULL END) as may15,
COUNT(CASE WHEN Posts.CreationDate < '2015-07-01' and Posts.CreationDate >= '2015-06-01' then 1 ELSE NULL END) as jun15,
COUNT(CASE WHEN Posts.CreationDate < '2015-08-01' and Posts.CreationDate >= '2015-07-01' then 1 ELSE NULL END) as jul15,
COUNT(CASE WHEN Posts.CreationDate < '2015-09-01' and Posts.CreationDate >= '2015-08-01' then 1 ELSE NULL END) as aug15,
COUNT(CASE WHEN Posts.CreationDate < '2015-10-01' and Posts.CreationDate >= '2015-09-01' then 1 ELSE NULL END) as sep15,
COUNT(CASE WHEN Posts.CreationDate < '2015-11-01' and Posts.CreationDate >= '2015-10-01' then 1 ELSE NULL END) as oct15,
COUNT(CASE WHEN Posts.CreationDate < '2015-12-01' and Posts.CreationDate >= '2015-11-01' then 1 ELSE NULL END) as nov15,
COUNT(CASE WHEN Posts.CreationDate < '2016-01-01' and Posts.CreationDate >= '2015-12-01' then 1 ELSE NULL END) as dec15,
COUNT(CASE WHEN Posts.CreationDate < '2016-02-01' and Posts.CreationDate >= '2016-01-01' then 1 ELSE NULL END) as jan16,
COUNT(CASE WHEN Posts.CreationDate < '2016-03-01' and Posts.CreationDate >= '2016-02-01' then 1 ELSE NULL END) as feb16,
COUNT(CASE WHEN Posts.CreationDate < '2016-04-01' and Posts.CreationDate >= '2016-03-01' then 1 ELSE NULL END) as mar16,
COUNT(CASE WHEN Posts.CreationDate < '2016-05-01' and Posts.CreationDate >= '2016-04-01' then 1 ELSE NULL END) as apr16,
COUNT(CASE WHEN Posts.CreationDate < '2016-06-01' and Posts.CreationDate >= '2016-05-01' then 1 ELSE NULL END) as may16,
COUNT(CASE WHEN Posts.CreationDate < '2016-07-01' and Posts.CreationDate >= '2016-06-01' then 1 ELSE NULL END) as jun16,
COUNT(CASE WHEN Posts.CreationDate < '2016-08-01' and Posts.CreationDate >= '2016-07-01' then 1 ELSE NULL END) as jul16,
COUNT(CASE WHEN Posts.CreationDate < '2016-09-01' and Posts.CreationDate >= '2016-08-01' then 1 ELSE NULL END) as aug16,
COUNT(CASE WHEN Posts.CreationDate < '2016-10-01' and Posts.CreationDate >= '2016-09-01' then 1 ELSE NULL END) as sep16,
COUNT(CASE WHEN Posts.CreationDate < '2016-11-01' and Posts.CreationDate >= '2016-10-01' then 1 ELSE NULL END) as oct16,
COUNT(CASE WHEN Posts.CreationDate < '2016-12-01' and Posts.CreationDate >= '2016-11-01' then 1 ELSE NULL END) as nov16,
COUNT(CASE WHEN Posts.CreationDate < '2017-01-01' and Posts.CreationDate >= '2016-12-01' then 1 ELSE NULL END) as dec16,
Tags.TagName

from Tags, PostTags, Posts p1, Posts

where Tags.Id = PostTags.TagId 
  and p1.Id = PostTags.PostId 
  and p1.Id = Posts.ParentId
  and Posts.PostTypeId = 2
  and Posts.CreationDate < '2017-01-01'
  and Posts.CreationDate >= '2015-01-01'

group by
  Tags.TagName

Enter Parameters

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