New and finished reviews per month

1

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Exchange

Q&A for meta-discussion of the Stack Exchange family of Q&A websites

---since the table ReviewTasks contains only date, we don't get any information about hours/minutes
---ReviewTaskTypeId
---1 = Suggested Edit
---2 = Close Votes
---3 = Low Quality Posts
---4 = First Post
---5 = Late Answer
---6 = Reopen Vote
;with new_cte AS (SELECT 
  eomonth(CreationDate) AS NDate,
  COUNT(Id) AS NCount
FROM ReviewTasks
WHERE (ReviewTaskTypeId=##type?2##)
GROUP BY eomonth(CreationDate)),
done_cte AS (SELECT
  eomonth(DeletionDate) AS DDate,
  COUNT(Id) AS DCount
FROM ReviewTasks
WHERE (ReviewTaskTypeId=##type##)
GROUP BY eomonth(DeletionDate))

SELECT
  n.NDate,
  n.NCount AS [New review tasks],
  d.DCount AS [Finished review tasks]
FROM new_cte n INNER JOIN done_cte d ON n.NDate=d.DDate
ORDER BY n.NDate

Enter Parameters

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