Week Day

0

Please login or register to vote for this query.

(click on this box to dismiss)

SharePoint

Q&A for SharePoint enthusiasts

WITH post_comments AS (
    SELECT
        postid,
        MIN(creationdate) AS first_comment
    FROM comments
    GROUP BY postid
)
SELECT
    p.id AS post_id,
    DATEDIFF(minute, p.CreationDate, pc.first_comment) AS response_time_in_minutes,
    DATENAME(weekday, p.CreationDate) AS day_of_week
FROM posts p
INNER JOIN post_comments pc ON p.id = pc.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)

Enter Parameters

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