Global number of Upvotes/Downvotes and their Ratio


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 Upvotes, Downvotes, ROUND(1.0*Upvotes/Downvotes, 3) as Ratio
    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 Votes
  WHERE VoteTypeId IN (2,3)
) as votecounts

Enter Parameters

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