SELECT UserId, COUNT(VoteTypeId) AS 'Total', COUNT( CASE ...

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

SELECT UserId,
 COUNT(VoteTypeId) AS 'Total',
 COUNT(
 CASE
   WHEN VoteTypeId = 2
   THEN VoteTypeId
   ELSE NULL
 END) AS 'Accepted',
 COUNT(
 CASE
   WHEN VoteTypeId = 3
   THEN VoteTypeId
   ELSE NULL
 END) AS 'Rejected'
FROM SuggestedEditVotes
INNER JOIN Users
ON SuggestedEditVotes.UserId = Users.Id
WHERE Users.Reputation > 2000 
GROUP BY UserId
HAVING COUNT(VoteTypeId) > 0
ORDER BY 4 asc,2 desc

Enter Parameters

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