Reopen Votes results

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

WITH #temp AS (SELECT
  DATEADD(WEEK, DATEDIFF(WEEK, 0, rt.CreationDate), 0) AS CreationDate,
  r.ReviewTaskResultTypeId AS Result
  FROM ReviewTasks AS rt
  INNER JOIN ReviewTaskResults AS r
    ON rt.CompletedByReviewTaskId = r.Id
  WHERE rt.ReviewTaskTypeId = 6 -- Reopen Vote
    AND rt.CreationDate >= '2021-07-01')
SELECT CreationDate,
  COUNT(*) AS 'Total',
  SUM(CASE Result WHEN 13 THEN 1 ELSE 0 END) AS 'Leave closed',
  SUM(CASE Result WHEN 13 THEN 0 ELSE 1 END) AS 'Reopen'
  FROM #temp
  GROUP BY CreationDate
  ORDER BY CreationDate

Enter Parameters

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