Old Zombies

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 'Unanswered & older than 3 days:' AS Category, COUNT(*) AS [Count]
FROM Posts
WHERE PostTypeId = 1 
  AND AnswerCount = 0 
  AND DATEDIFF(DAY,CreationDate,GETDATE()) >= 3

UNION

SELECT 'First answer > 3 days after question:', COUNT(*) FROM (
  SELECT Id
  FROM Posts
  WHERE PostTypeId = 1 AND AnswerCount > 0
  EXCEPT
  SELECT Q.Id
  FROM Posts Q
    INNER JOIN Posts A ON A.ParentId = Q.Id 
      AND (DATEDIFF(DAY,Q.CreationDate,A.CreationDate) < 3)
  GROUP BY Q.Id
) A

Enter Parameters

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