First Questions (answered within 24 hours)

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

WITH
  FirstQuestions AS (
    SELECT O.Id AS QuestionID, O.OwnerUserId AS UserID, O.CreationDate
    FROM Posts O
    WHERE O.PostTypeId = 1 AND O.CreationDate = (
      SELECT MIN(I.CreationDate)
      FROM Posts I
      WHERE I.OwnerUserId = O.OwnerUserId
    )
  ),
  FirstAnswers AS (
    SELECT O.ParentId AS QuestionID, O.Id AS AnswerId, O.OwnerUserId AS UserId, O.CreationDate
    FROM Posts O
    WHERE O.PostTypeId = 2 AND O.CreationDate = (
      SELECT MIN(I.CreationDate)
      FROM Posts I
      WHERE I.ParentId = O.ParentId
    )
  )
  
SELECT 
    YEAR(Q.CreationDate) AS Year
  , MONTH(Q.CreationDate) AS Month
  , COUNT(*) AS CountOfQuestions
FROM FirstQuestions Q
  INNER JOIN FirstAnswers A ON A.QuestionID = Q.QuestionID
WHERE A.CreationDate BETWEEN Q.CreationDate AND DATEADD(HOUR,24,Q.CreationDate)
GROUP BY YEAR(Q.CreationDate), MONTH(Q.CreationDate) WITH ROLLUP

Enter Parameters

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