Up, accept and down votes over time

0

Please login or register to vote for this query.

(click on this box to dismiss)

... to balance the requests that ask to do something about down votes

Server Fault

Q&A for system and network administrators

select eomonth(votes.creationdate)
    , sum(case when votetypeid = 1 then 1 else 0 end)  accept
    , sum(case when votetypeid = 2 then 1 else 0 end)  up
    , sum(case when votetypeid = 3 then 1 else 0 end)  down
    , sum(case when votetypeid = 2 and posttypeid = 1 then 1 else 0 end)  [Q-up]
    , sum(case when votetypeid = 3 and posttypeid = 1 then 1 else 0 end)  [Q-down]
    , sum(case when votetypeid = 2 and posttypeid = 2 then 1 else 0 end)  [A-up]
    , sum(case when votetypeid = 3 and posttypeid = 2 then 1 else 0 end)  [A-down]
    , sum(case when votetypeid = 3 and commentcount = 0 then 1 else 0 end) [down-without-comment]
from votes
inner join postswithdeleted p on p.id = votes.postid
where votetypeid in (1,2,3)
and posttypeid in (1,2)
and votes.creationdate <=  eomonth(dateadd(m, -1, getdate()))
group by eomonth(votes.creationdate)
order by 1

Enter Parameters

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