Bad question days by month

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A for music historians, critics, and fans

select
    year_,
    month_,
    sum(case when down > 0 then 1 else 0 end) as bad_days
from (
  select
    YEAR(creationDate) as year_,
    MONTH(creationDate) as month_,
    max(case when score > 0 then 1 else 0 end) as up,
    max(case when score < 1 then 1 else 0 end) as down
  from Posts
  where OwnerUserId = ##UserId## and PostTypeId = 1 -- a question
  group by creationDate
) question_days group by year_, month_ order by year_ asc, month_ asc;

Enter Parameters

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