Questions and Answers per day since 2019

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

WITH MonthlyCounts AS (
    SELECT
        DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), 1) AS [Month],
        PostTypeId,
        COUNT(*) AS PostCount
    FROM
        Posts
    WHERE
        CreationDate >= '2019-01-01'
        AND PostTypeId IN (1, 2)
    GROUP BY
        DATEFROMPARTS(YEAR(CreationDate), MONTH(CreationDate), 1), PostTypeId
)
SELECT
    mc.[Month],
    SUM(CASE WHEN mc.PostTypeId = 1 THEN mc.PostCount ELSE 0 END) AS Questions,
    SUM(CASE WHEN mc.PostTypeId = 2 THEN mc.PostCount ELSE 0 END) AS Answers
FROM
    MonthlyCounts mc
GROUP BY
    mc.[Month]
ORDER BY
    mc.[Month] DESC;

Enter Parameters

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