counting the number of deleted answers on a post

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

SELECT Q.Id AS [Post Link], COUNT(DISTINCT(A.Id)) AS 'Deleted Answers'
FROM Posts Q
JOIN PostsWithDeleted A 
  ON A.ParentId = Q.Id
WHERE Q.PostTypeId = 1 -- Question
  AND A.PostTypeId = 2 -- Answer
  AND A.DeletionDate IS NOT NULL
GROUP BY Q.Id
ORDER BY 'Deleted Answers' DESC

Enter Parameters

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