Total count of up- and downvotes in the system from the Users and the Votes table

1

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

SELECT
  'Users Table' AS Source,
  SUM(UpVotes) AS Ups,
  SUM(DownVotes) AS Downs
FROM Users

UNION

SELECT
  'Votes Table' AS Source,
  COUNT(CASE WHEN VoteTypeId=2 THEN 1 ELSE NULL END) Ups,
  COUNT(CASE WHEN VoteTypeId=3 THEN 1 ELSE NULL END) Downs
FROM Votes

Enter Parameters

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