up and downvotes per day, split in Q and A

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

select v.creationdate
     , count(*)  [Total]
     , sum(case when votetypeid = 2 then 1 else 0 end) [upvotes]
     , sum(case when votetypeid = 3 then 1 else 0 end) [downvotes]
     , sum(case when votetypeid = 2 and posttypeid = 1 then 1 else 0 end) [Q - upvotes]
     , sum(case when votetypeid = 3 and posttypeid = 1 then 1 else 0 end) [Q - downvotes]
     , sum(case when votetypeid = 2 and posttypeid = 2 then 1 else 0 end) [A - upvotes]
     , sum(case when votetypeid = 3 and posttypeid = 2 then 1 else 0 end) [A - downvotes]
from votes v
inner join posts p on p.id = v.postid and posttypeid in (1,2) -- Q, A
where v.votetypeid in (2,3) -- Up, Down
group by v.creationdate
order by v.creationdate desc

Enter Parameters

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