Positive vs. negatively scored questions by 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

declare @epoch datetime = 'March 1, 2014'

select dateadd(month, datediff(month, @epoch, q.CreationDate), @epoch) Month,
       case
         when Score > 0 and PostTypeId = 1 then 'welcome questions'
         when Score = 0 and PostTypeId = 1 then 'neutral questions'
         when Score < 0 and PostTypeId = 1 then 'unwelcome questions'
         else 'answers'
       end type,
       --PostTypeId,
       count(*) N
from PostsWithDeleted q 
where PostTypeId in (1, 2)
group by datediff(month, @epoch, q.CreationDate),
         case
         when Score > 0 and PostTypeId = 1 then 'welcome questions'
         when Score = 0 and PostTypeId = 1 then 'neutral questions'
         when Score < 0 and PostTypeId = 1 then 'unwelcome questions'
         else 'answers'
       end ,
       PostTypeId
order by type desc, Month;

Enter Parameters

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