Q&A about the site for members of the workforce navigating the professional setting
declare @threshold int = ##mineditsbest##; declare @thresh2 int = ##mineditsworst##; 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 all select 'top approvee' as type, * from (select top 20 * from editors order by approved desc) b union all select 'top overall' as type, * from (select top 20 * from editors order by "total edits" desc) c union all select 'best percentage' as type, * from (select top 20 * from editors where "total edits" > @threshold order by "percentage approved" desc, approved desc) d union all select 'worst percentage' as type, * from (select top 20 * from editors where "total edits" > @thresh2 order by "percentage approved" asc) e