Invalidated Close Vote Reviews due to (assumed) Expired Votes

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

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

SELECT 'site://posts/' + CAST(PostId AS nvarchar) + '/timeline|' + p.Title as [TimeLine Link], DATEDIFF(d, r.CreationDate, r.DeletionDate) as Invalidated_Days
FROM ReviewTasks r
JOIN Posts p ON r.PostId = p.Id
  WHERE
  p.PostTypeId = @Question
  AND
  (
    (
      DATEDIFF(d, r.CreationDate, r.DeletionDate) >= 14 AND
      DATEDIFF(d, r.CreationDate, r.DeletionDate) <= 17
    )
    OR
    (
      DATEDIFF(d, r.CreationDate, r.DeletionDate) >=4 AND
      DATEDIFF(d, r.CreationDate, r.DeletionDate) <=7
    )
  )
  AND
  r.ReviewTaskTypeId = @CloseVoteReview
  AND
  r.ReviewTaskStateId = @Invalid
  AND
  YEAR(r.DeletionDate) = 2021
ORDER BY r.DeletionDate DESC;

Enter Parameters

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