Moderator Score


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @user_id int = ##UserId##
declare @rep_score as int
declare @badge_score as int

select @rep_score = cast((Reputation / 1000) as int)
from Users
where Id = @user_id

if @rep_score > 20
  set @rep_score = 20;

with BadgeList as (
  select Name
  from Badges
  where UserId = @user_id
  and Name in ('Civic Duty', 'Cleanup', 'Constituent', 'Convention', 'Copy Editor',
               'Deputy', 'Electorate', 'Enthusiast', 'Explainer', 'Investor',
               'Marshal', 'Organizer', 'Quorum', 'Refiner', 'Reviewer',
               'Sportsmanship', 'Steward', 'Strunk & White', 'Tag Editor',
  group by Name
select @badge_score = count(*)
from BadgeList

select @user_id as [User Link],
       @rep_score as [Reputation Score],
       @badge_score as [Badge Score],
       @rep_score + @badge_score as [Total]

Enter Parameters

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