See top suggested, approved, rejected editors

1

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

declare @threshold int = ##threshold##;

with editors as (
select 
  userid, userid as [User Link], count(*) as "total edits",
  sum(rej) as rejected, sum(app) as approved,
  sum(app) * 100 / count(*) as "percentage approved"
from
  (select owneruserid as userid, 
          case when rejectiondate is null then 0 else 1 end as rej,
          case when approvaldate is null then 0 else 1 end as app
          from suggestededits) a
group by userid
)

select 'top rejectee' as type, * 
  from (select top 20 * from editors order by rejected desc) a
union
select 'top approvee' as type, * 
  from (select top 20 * from editors order by approved desc) b
union
select 'top overall' as type, *
  from (select top 20 * from editors order by "total edits" desc) c
union
select 'best percentage' as type, *
  from (select top 20 * 
        from editors 
        where "total edits" > @threshold 
        order by "percentage approved" desc, approved desc) d
union 
select 'worst percentage' as type, *
  from (select top 20 * 
        from editors 
        where "total edits" > 20 
        order by "percentage approved" asc) e

Enter Parameters

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