Distribution of the number of review actions on close review tasks that were invalidated

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Apps

Q&A for apps, scripts, and development with the Stack Exchange API

declare @epoch as datetime = DATEADD(WEEK, - ##Weeks:int?52## - 1, CURRENT_TIMESTAMP);

select coalesce(total, 0) as '# Of Review Actions', 
       count(t.Id) as 'Count', 
       count(t.Id) * 100.0 / sum(count(*)) over () as 'Percent'
from ReviewTasks t
left outer join (
  select count(r.ReviewTaskId) as total, r.ReviewTaskId 
  from ReviewTaskResults r group by r.ReviewTaskId
) 
  as counts
  on t.Id = counts.ReviewTaskId 
where t.ReviewTaskTypeId = 2 -- Close
and t.ReviewTaskStateId = 3 -- Invalid
and t.CreationDate > @epoch
group by total
order by '# Of Review Actions';

Enter Parameters

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