Displays the number of upvotes and downvotes received on questions and answers and their ratio.
Q&A for professional and enthusiast programmers
-- User Ratio of Upvotes to Downvotes received. -- Displays the number of upvotes and downvotes received on questions and answers and their ratio. 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, (CAST(SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS float) / CAST(SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS float)) AS UpVoteDownVoteRatio from Votes v inner join Posts p on v.PostId=p.Id where p.OwnerUserId=##UserId##