SELECT COUNT(*) Total, COUNT(e.ApprovalDate) Approved, CO...

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

SELECT
  COUNT(*) Total,
  COUNT(e.ApprovalDate) Approved,
  COUNT(e.RejectionDate) Rejected,
  SUM(IIF(res.ReviewTaskResultTypeId = 22, 1, 0)) OverrideToApprove,
  SUM(IIF(res.ReviewTaskResultTypeId = 23, 1, 0)) OverrideToReject
FROM 
  SuggestedEdits e
  LEFT OUTER JOIN (
    SELECT 
      t.SuggestedEditId,
      r.ReviewTaskResultTypeId
    FROM 
      ReviewTasks t
      INNER JOIN ReviewTaskResults r on r.ReviewTaskId = t.Id
    WHERE 
      r.ReviewTaskResultTypeId in (22, 23)
  ) res on res.SuggestedEditId = e.Id
WHERE 
  e.CreationDate >= '2017-04-22'

Enter Parameters

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