Body Length vs Response Time

0

Please login or register to vote for this query.

(click on this box to dismiss)

Biology Meta

Q&A about the site for biology researchers, academics, and students

-- Calculate body length vs response time for posts with comments
-- Between '2021-05-03' and '2021-05-10'

WITH post_comments AS
(
    SELECT
        postid,
        MIN(creationdate) AS first_comment
    FROM comments
    GROUP BY postid
)
SELECT
    posts.id AS post_id,
    LEN(posts.body) AS body_length,
    DATEDIFF(minute, posts.CreationDate, post_comments.first_comment) AS response_time_in_minutes
FROM posts
INNER JOIN post_comments
    ON posts.id = post_comments.postid
WHERE
    posts.CreationDate >= '2021-05-03'
    AND posts.CreationDate <= '2021-05-10'
    AND (posts.ClosedDate IS NULL OR posts.ClosedDate <= '2021-05-10')
    AND posts.posttypeid = 1;  -- Ensure we are only considering questions (posttypeid = 1)

Enter Parameters

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