Number and % of users with breakdown by privilege

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

declare @privileges table (
  Name varchar(24) not null,
  Rep int not null
)

insert into @privileges
values
  ('site analytics', 25000),
  ('trusted user', 20000),
  ('protect questions', 15000),
  ('moderator tools', 10000),
  ('tag wiki reviews',5000),
  ('close votes',3000),
  ('tag synonyms',2500),
  ('edit posts',2000),
  ('create tags',1500),
  ('established user',1000),
  ('create gallery chats', 1000),
  ('review queues',500),
  ('view close votes',250),
  ('reduce ads',200),
  ('vote down',125),
  ('edit community wikis',100),
  ('create chat rooms', 100),
  ('set bounties', 75),
  ('comment everywhere', 50),
  ('talk in chat', 20),
  ('flag posts', 15),
  ('vote up', 15),
  ('removed restrictions', 10),
  ('create wiki posts', 10),
  ('participate in meta', 5),
  ('create posts', 1)
  
declare @total int = 0;
select @total = count(id) from users;

select
  Name,
  Rep,
  el as [Eligible],
  format(cast(el as float) / cast(@total as float) * 100, 'N2') as [Of total]
from(
  select
    p.Name,
    p.Rep,
    count(1) as [el]
  from
    @privileges as p
    join users as u on u.Reputation >= p.Rep
  group by
    p.Name,
    p.Rep
) as sub
order by
    Rep desc

Enter Parameters

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