SELECT DATEPART(year, CreationDate) AS Year, DATEPART(mo...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Writing

Q&A for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing

-- Daily Statistics on Stack Overflow (January 2020 to December 2023)
-- This query returns daily counts of posts, questions, answers, and unique users in each category.

SELECT
    DATEPART(year, CreationDate) AS Year,
    DATEPART(month, CreationDate) AS Month,
    DATEPART(day, CreationDate) AS Day,
    COUNT(*) AS Posts,
    COUNT(CASE WHEN PostTypeId = 1 THEN 1 END) AS Questions,
    COUNT(CASE WHEN PostTypeId = 2 THEN 1 END) AS Answers,
    COUNT(DISTINCT OwnerUserId) AS Posters,
    COUNT(DISTINCT CASE WHEN PostTypeId = 1 THEN OwnerUserId END) AS Questioners,
    COUNT(DISTINCT CASE WHEN PostTypeId = 2 THEN OwnerUserId END) AS Answerers
FROM
    Posts
WHERE
    CreationDate BETWEEN '2020-01-01' AND '2024-01-01'
GROUP BY
    DATEPART(year, CreationDate),
    DATEPART(month, CreationDate),
    DATEPART(day, CreationDate)
ORDER BY
    Year,
    Month,
    Day;

Enter Parameters

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