2017 Posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

WITH Answers AS (
    SELECT 
        Posts.CreationDate AS 'AnswerCreationDate', 
        Posts.Id AS 'AnswerId'
    FROM Posts
    JOIN PostTypes on Posts.PostTypeId = PostTypes.Id
    WHERE PostTypes.Id = 2
)


SELECT
    /*Posts.CreationDate,
    Posts.AcceptedAnswerId,
    Answers.AnswerId, 
    Answers.AnswerCreationDate, */
    DATEDIFF(SECOND, Posts.CreationDate, Answers.AnswerCreationDate) AS SecsToAnswer
/*    AVG(DATEDIFF(SECOND, Posts.CreationDate, Answers.AnswerCreationDate)) AS AvgSecsToAnswer */
FROM Posts
JOIN Answers on Posts.AcceptedAnswerId = Answers.AnswerId

WHERE Posts.CreationDate BETWEEN '2017-01-01' AND '2017-12-31'

Enter Parameters

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