Views 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

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

Enter Parameters

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