Close Reviews Completed

0

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

DECLARE @Question tinyint = 1;
DECLARE @Answer tinyint = 2;
DECLARE @CloseVoteReview tinyint = 2;
DECLARE @Invalid tinyint = 3;

WITH CloseReview AS (
  SELECT state.Name as State,
  Count(*) as StateTotal,
  CASE
    WHEN state.Name = 'Completed' then 'Comp'
    ELSE 'Not Completed'
    END as StateBin
  FROM ReviewTasks r
  JOIN ReviewTaskStates state ON r.ReviewTaskStateId = state.Id 
  WHERE
    r.ReviewTaskTypeId = @CloseVoteReview
  AND
    YEAR(r.DeletionDate) = 2021
    AND MONTH(r.DeletionDate) = 12
  GROUP BY Name
)

SELECT StateBin,
  StateTotal,
  FORMAT(((1.00 * StateTotal)/(SELECT sum(StateTotal) FROM CloseReview)), 'P2') As "Percent"
  
  
FROM CloseReview

Enter Parameters

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