Questions containing "Wh" or "?" vs Response Time

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers Meta

Q&A about the site for Drupal developers and administrators

WITH post_comments AS
(
    SELECT
        postid,
        MIN(creationdate) AS first_comment
    FROM comments
    GROUP BY postid
),
question_title_analysis AS
(
    SELECT
        id AS post_id,
        CASE
            WHEN title LIKE '%Wh%' THEN 1
            WHEN title LIKE '%?%' THEN 1
            ELSE 0
        END AS contains_wh_or_question
    FROM posts
    WHERE
        CreationDate >= '2021-05-03'
        AND CreationDate <= '2021-05-10'
        AND (ClosedDate IS NULL OR ClosedDate <= '2021-05-10')
        AND posttypeid = 1  -- Ensure we are only considering questions (posttypeid = 1)
)
SELECT
    posts.id AS post_id,
    question_title_analysis.contains_wh_or_question,
    DATEDIFF(minute, posts.CreationDate, post_comments.first_comment) AS response_time_in_minutes
FROM question_title_analysis
INNER JOIN post_comments
    ON question_title_analysis.post_id = post_comments.postid
INNER JOIN posts
    ON question_title_analysis.post_id = posts.id;

Enter Parameters

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