Total questions and answers per calendar month

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   DatePart(year, CreationDate) * 100
         + DatePart(month, CreationDate) YearMonth
       , sum(case when ParentID is null then 1 else 0 end) TotalQuestions
       , sum(case when ParentID is not null then 1 else 0 end) TotalAnswers
  from Posts
 group by DatePart(year, CreationDate) 
       ,  DatePart(month, CreationDate)
 order by DatePart(year, CreationDate) 
       ,  DatePart(month, CreationDate)

Enter Parameters

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