Election Candidate Score Leaderboard

0

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for those using, extending or developing Emacs

WITH prelim AS 
(
   SELECT u.Id AS Username, 
      u.Reputation AS Reputation,
      Floor(10+0.5*u.Reputation/1000-0.5*Abs(u.Reputation/1000-20)) AS CappedRep, 
      Count(distinct b.Name) AS BadgeCount, 
      u.LastAccessDate AS LastAccess 
   FROM Users u
   INNER JOIN Badges b ON b.UserId = u.Id
   WHERE u.Reputation >= 1000 AND 
     b.Name IN (
         'Civic Duty', 
         'Cleanup',
         'Constituent',
         'Convention',
         'Copy Editor',
         'Deputy',
         'Electorate',
         'Enthusiast',
         'Explainer',
         'Investor',
         'Marshal',
         'Organizer',
         'Quorum',
         'Refiner',
         'Sportsmanship',
         'Strunk & White',
         'Tag Editor',
         'Reviewer',
         'Steward', 
         'Yearling')
   Group BY u.Id, u.Reputation, u.LastAccessDate
) 
  
SELECT 
   Username AS [User Link], 
   CappedRep+BadgeCount AS Total, 
   CappedRep, BadgeCount, LastAccess 
FROM prelim 
ORDER BY Total DESC, Reputation DESC

Enter Parameters

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