select u.id U,p.PostTypeid, sum(case when v.voteTypeid=2 ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Audio-Video Production Meta

Q&A for engineers, producers, editors, and enthusiasts spanning the fields of audio, video, and media creation

select u.id U,p.PostTypeid,
sum(case when v.voteTypeid=2 then 1 else 0 end) UP, 
sum(case when v.voteTypeid=3 then 1 else 0 end) Down
from posts p
join users u on p.OwnerUserId = u.Id 
join votes v on p.id=v.Postid
where p.creationDate between '2011-03-12' and '2012-03-11'
and v.voteTypeid in (2,3) and p.PostTypeid in (1,2)
group by u.id,p.PostTypeid
order by UP desc

Enter Parameters

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