declare @minedits int = ##minimumedits##; with editors a...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

declare @minedits int = ##minimumedits##;

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 20 * 
from editors 
where "total edits" > @minedits 
order by "percentage approved" desc, approved desc

Enter Parameters

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