Close Reviews Completed

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping

Q&A for gardeners and landscapers

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
  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 State,
  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