Top users by candidate score

1

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Different

Q&A for power users of Apple hardware and software

Select 
  ROW_NUMBER() OVER(ORDER BY CappedRep+BadgeCount DESC) as Rank,
  Username as [User Link],
  CappedRep+BadgeCount as Total,
  CappedRep,
  BadgeCount,
  ModBadges,
  ParticipationBadges,
  EdBadges "EditingBadges"
From (
   Select u.Id As Username, 
     (case when u.Reputation > 20000 then 20000 else u.Reputation end)/1000 As CappedRep, 
      Count(distinct case when 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') then b.Name else null end) As BadgeCount, 
      
      count(distinct iif(b.Name in ('Civic Duty', 
         'Cleanup',
         'Deputy',
         'Electorate',
         'Marshal',
         'Sportsmanship',
         'Reviewer',
         'Steward'), b.Name, null)) ModBadges,
      count(distinct iif(b.Name in (
         'Constituent',
         'Convention',
         'Enthusiast',
         'Investor',
         'Quorum',
         'Yearling'), b.Name, null)) ParticipationBadges,
      count(distinct iif(b.Name in (
         'Organizer',
         'Copy Editor',
         'Explainer',
         'Refiner',
         'Tag Editor',
         'Strunk & White'), b.Name, null)) EdBadges
         
      
   From Users u
   left join Badges b on b.UserId=u.Id
  Group By u.Id, u.Reputation
) cscores
WHERE
  CappedRep+BadgeCount > 0
ORDER BY
  Total DESC

Enter Parameters

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