Top users by the number of times they earned 200/day

0

Please login or register to vote for this query.

(click on this box to dismiss)

This query finds the top users by the number of times they've earned 200/day, and gives indication about the progress towards Epic and Legendary badges. Think of it as the number of times Mortarboard badge could have been earned

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT Id AS [User Link], Reputation, (
	SELECT Count (TotalRep)
	  FROM (
			   SELECT 
					SUM(case votes.votetypeid 
							WHEN 1 THEN 15
							WHEN 2 THEN 10
							WHEN 9 THEN BountyAmount
					 END) as TotalRep,
					 Votes.CreationDate AS CreationDate
			  FROM   Posts
					 INNER JOIN Votes
					   ON Votes.PostId = Posts.Id
						  
			  WHERE  Posts.OwnerUserId = U.Id
					 AND Posts.CommunityOwnedDate IS NULL
			  GROUP  BY Votes.CreationDate
	  ) t
	  WHERE TotalRep>=200) AS RepCapDays
FROM Users U
WHERE U.Reputation >= 200
ORDER BY 3 DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results