How many upvotes and downvotes have I received?

1

Please login or register to vote for this query.

(click on this box to dismiss)

Russian Language

Q&A for students, teachers, and linguists wanting to discuss the finer points of the Russian language

SELECT 
  SUM(CASE WHEN a.VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes,
  SUM(CASE WHEN a.VoteTypeId = 3 THEN 1 ELSE 0 END) AS DownVotes,
  (CAST(SUM(CASE WHEN a.VoteTypeId = 2 THEN 1 ELSE 0 END) AS FLOAT) / COUNT(*)) * 100 AS UpVotePercentage,
  (CAST(SUM(CASE WHEN a.VoteTypeId = 3 THEN 1 ELSE 0 END) AS FLOAT) / COUNT(*)) * 100 AS DownVotePercentage
FROM Votes a
  INNER JOIN Posts b
    ON 
      a.PostId = b.Id
      AND b.PostTypeId IN (1,2) -- Only questions and answers
WHERE 
  b.OwnerUserId = ##UserId##
  AND a.VoteTypeId IN (2,3) -- Only up and down votes

Enter Parameters

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