What Percentile of Users am I in (reputation-wise)?


Please login or register to vote for this query.

(click on this box to dismiss)


Q&A for those using, extending or developing Emacs

declare @TotalRep bigint
declare @UserCount bigint
declare @Top10RepTotal decimal(18,4)
declare @Bottom90RepTotal decimal(18,4)

select @TotalRep = sum(reputation) from users

select @UserCount = count(1) from users where reputation > 0

select @Top10RepTotal = sum(tmp.rep) from
          (select top(10) percent reputation as rep
           from users
           order by reputation desc) as tmp

select @Bottom90RepTotal = sum(tmp.rep) from
          (select top(90) percent reputation as rep
           from users
           order by reputation) as tmp

select @TotalRep TotalRep,
       @UserCount UserCount,
       @Top10RepTotal Top10RepTotal,
       @Bottom90RepTotal Bottom90RepTotal,
       cast((@Top10RepTotal/@TotalRep)*100 as decimal(18,4)) Top10PercentageOfRep,
       cast((@Bottom90RepTotal/@TotalRep)*100 as decimal(18,4)) Bottom90PercentageOfRep

Enter Parameters

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