Time to answer (first answer, last answer, accepted answer, highest-scored answer)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Android Enthusiasts

Q&A for enthusiasts and power users of the Android operating system

WITH
    Answers AS (
        SELECT *
            FROM Posts
            WHERE PostTypeId = 2 -- Answers
    )
SELECT TOP 100000
        Questions.Id AS [Q ID],
        Questions.AnswerCount AS [Q Answers],
        Questions.Tags AS [Q Tags],
        Questions.CreationDate AS [Q Date],
        CAST(DATEDIFF(mi, Questions.CreationDate, FirstAnswer.CreationDate) AS NVARCHAR) AS [Minutes to First Ans],
        CAST(DATEDIFF(mi, Questions.CreationDate, AcceptedAnswer.CreationDate) AS NVARCHAR) AS [Minutes to Accepted Ans]
    FROM Posts AS Questions
        LEFT OUTER JOIN Answers AS FirstAnswer
            ON FirstAnswer.ParentId = Questions.Id
        LEFT OUTER JOIN Answers AS AcceptedAnswer
            ON AcceptedAnswer.Id = Questions.AcceptedAnswerId
    WHERE
        Questions.PostTypeId = 1 -- Questions
        AND Questions.Tags like '<java>%'
        AND year(Questions.CreationDate) between '2015' AND '2015' 
        AND month(Questions.CreationDate) between '1' AND '2'
        AND FirstAnswer.Id = (
            SELECT TOP 1 Id
                FROM Answers
                WHERE
                    Answers.ParentId = Questions.Id
                ORDER BY CreationDate ASC
        )
        Order by Questions.CreationDate DESC
;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results