Number of Votes for Electorate, Civic Duty and Other

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-------------------- ELECTORATE
-- SELECT COUNT(u.id) as num_achievers, SUM(UpVotes)+SUM(DownVotes) as num_votes
-- FROM Users u
-- INNER JOIN Badges b1
-- ON (b1.Name IN ('Electorate') and b1.UserId=u.Id);

-------------------- CIVIC DUTY
-- SELECT COUNT(u.id) as num_achievers, SUM(UpVotes)+SUM(DownVotes) as num_votes
-- FROM Users u
-- INNER JOIN Badges b1
-- ON (b1.Name IN ('Civic Duty') and b1.UserId=u.Id)
-- LEFT JOIN Badges b2
-- ON (b2.Name IN ('Electorate') and b2.UserId=u.Id)
-- WHERE b2.UserId IS NULL;

-------------------- OTHER
-- SELECT COUNT(u.id) as num_achievers, SUM(UpVotes)+SUM(DownVotes) as num_votes
-- FROM Users u
-- LEFT JOIN Badges b1
-- ON (b1.Name IN ('Civic Duty') and b1.UserId=u.Id)
-- LEFT JOIN Badges b2
-- ON (b2.Name IN ('Electorate') and b2.UserId=u.Id)
-- WHERE b1.UserId IS NULL AND b2.UserId IS NULL;

SELECT SUM(UpVotes)+SUM(DownVotes) as num_votes FROM Users u

Enter Parameters

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