Up/down vote breakdown for a post


Please login or register to vote for this query.

(click on this box to dismiss)

Physics Meta

Q&A about the site for active researchers, academics and students of physics

  Posts.Id AS [Post Link],
  Posts.Score AS 'Score',
  COUNT(CASE WHEN Votes.VoteTypeId = 2 THEN 1 END) AS 'UpVotes',
  COUNT(CASE WHEN Votes.VoteTypeId = 3 THEN 1 END) AS 'DownVotes'
FROM Posts
JOIN Votes ON Votes.PostId = Posts.Id
WHERE Posts.Id = ##post:int##
   -- post: Post Id to query
  AND (Votes.VoteTypeId = 2 OR Votes.VoteTypeId = 3)
GROUP BY Posts.Id, Posts.Score

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results