Stack Overflow questions answer count per year

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 year(creationdate)
     , sum(case when posttypeid=1 and deletiondate is null then 1 else 0 end) as Question
     , sum(case when posttypeid=2 and deletiondate is null then 1 else 0 end) as Answer
     , sum(case when posttypeid=1 and deletiondate is not null then 1 else 0 end) as [ Deleted Question]
     , sum(case when posttypeid=2 and deletiondate is not null then 1 else 0 end) as [Deleted Answer]
     , sum(case when posttypeid=4 and deletiondate is null then 1 else 0 end) as [Tag Excerpt]
     , sum(case when posttypeid=5 and deletiondate is null then 1 else 0 end) as [Tag Wiki]
from postswithdeleted       
group by year(creationdate)
order by year(creationdate) desc

Enter Parameters

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