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