Vote ratio

1

Please login or register to vote for this query.

(click on this box to dismiss)

Super User

Q&A for computer enthusiasts and power users

WITH Totals_CTE AS (
  SELECT
    SUM(UpVotes) TotalUpVotes,
    SUM(DownVotes) TotalDownVotes
  FROM Users
  WHERE
    Reputation > ##RepThreshold:int##
    AND DownVotes > 0
    AND (UpVotes + DownVotes) > ##VoteThreshold:int##
)
SELECT
  Id as [User Link],
  ROUND(1.0 * UpVotes / DownVotes, 2) Ratio,
  Reputation,
  UpVotes,
  DownVotes,
  FORMAT(1.0 * UpVotes / (SELECT TotalUpVotes FROM Totals_CTE), 'P') [UpVote%Share],
  FORMAT(1.0 * DownVotes / (SELECT TotalDownVotes FROM Totals_CTE), 'P') [DownVote%Share]
FROM Users
WHERE
  Reputation > ##RepThreshold:int##
  AND DownVotes > 0
  AND (UpVotes + DownVotes) > ##VoteThreshold:int##
ORDER BY (UpVotes + DownVotes) DESC;

Enter Parameters

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