Up/down votes for my answers

1

Please login or register to vote for this query.

(click on this box to dismiss)

Up/down vote count for my answers

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- Up/down votes for my answers
-- Up/down vote count for my answers

SELECT
    SUM(CASE WHEN votes.votetypeid = 2 THEN 1 ELSE 0 END) AS UpVotes,
    SUM(CASE WHEN votes.votetypeid = 3 THEN 1 ELSE 0 END) AS DownVotes,
    SUM(CASE WHEN votes.votetypeid IN (2, 3) THEN 1 ELSE 0 END) AS TotalVotes
FROM votes
INNER JOIN posts ON votes.postid = posts.id
WHERE
    posts.posttypeid = 2 AND
    posts.owneruserid = ##UserId##

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results