Bypass 1000 reputation

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Apps

Q&A for apps, scripts, and development with the Stack Exchange API

SELECT UpVotes, DownVotes, COUNT(*) AS AnswersCount
FROM (
  SELECT 
      SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes,
      SUM(CASE WHEN VoteTypeId = 3 THEN -1 ELSE 0 END) AS DownVotes
      From Posts
      INNER JOIN Votes ON Votes.PostId = Posts.Id and (VoteTypeId = 2 OR VoteTypeId = 3)
  WHERE 
      Posts.id = ##POSTID##
  GROUP BY Posts.id 
) VotesCount
GROUP BY UpVotes, DownVotes 
ORDER BY UpVotes DESC

Enter Parameters

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