test

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

-- Top-rated users if there was no reputation cap

declare @UncappedReputation table (id int, rep int, uncapped int)
insert @UncappedReputation
select top 1000
    id = Users.Id,
    rep = Users.Reputation,
    uncapped = SUM(CASE
        WHEN VoteTypeId = 1 THEN 15                    -- Accepted answer
        WHEN VoteTypeId = 2 AND PostTypeId = 1 THEN 5  -- Upvoted question
        WHEN VoteTypeId = 2 AND PostTypeId = 2 THEN 10 -- Upvoted answer
        WHEN VoteTypeId = 3 THEN -2                    -- Downvote
        WHEN VoteTypeId = 9 THEN BountyAmount          -- Earned Bounty
    END)
from
    Votes
  INNER JOIN 
    Posts ON Posts.Id = Votes.PostId
  INNER JOIN
    Users ON Users.Id = Posts.OwnerUserId
group by
    Users.Id,
    Users.Reputation
    

select top 1000
    t.id as [User Link],
    t.rep as Reputation,
    t.uncapped as UncappedRepucation,
    t.uncapped - t.rep as Lost,
    (t.uncapped - t.rep) / t.rep as PercentLost
from
    @UncappedReputation t
order by
    PercentLost DESC

Enter Parameters

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