count of questions 1 hour,1-5 hours,5-24 hours,1-7 days , more than 7 days

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint

Q&A for SharePoint enthusiasts

SELECT COUNT(*)
FROM Posts Q
JOIN Posts A ON A.ParentId = Q.Id
WHERE Q.PostTypeId = 1  -- Question
  AND A.PostTypeId = 2  -- Answer
  AND DATEDIFF(day, Q.CreationDate, A.CreationDate) > 1
  AND A.Id = (
    SELECT MIN(A1.Id)
    FROM Posts A1
    WHERE A1.ParentId = Q.Id
      AND A1.PostTypeId = 2
  )

Enter Parameters

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