upvote and downvote count broken down by post type

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

select count(*), pt.name, vt.name
from Votes v, Posts p, PostTypes pt, VoteTypes vt
where v.postid = p.id
and v.votetypeid in (2, 3)
and p.posttypeid in (1, 2)
and pt.id = p.posttypeid
and vt.id = v.votetypeid
group by pt.name, vt.name
order by pt.name, vt.name

Enter Parameters

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