Questions & Answers Post Disparity per Month in [Date Range]

1

Please login or register to vote for this query.

(click on this box to dismiss)

Historically, SO has always had more answers posted than questions, but this changed in February of 2020. This query totals of the amount of questions & answers posted, and gives the difference between them (Total A's - total Q's), on [site] between [date range], grouped by year-month.

Ask Different

Q&A for power users of Apple hardware and software

DECLARE @SEDEUpdated AS DATETIME = (SELECT TOP 1 LastAccessDate FROM Users ORDER BY LastAccessDate DESC)

SELECT
  DATEFROMPARTS(YEAR(p.CreationDate), MONTH(p.CreationDate), 1) AS [Year-Month .],
  COUNT(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE NULL END) AS [Qs],
  COUNT(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE NULL END) AS [As],
  --ABS
  (COUNT(CASE WHEN p.PostTypeId = 2 THEN 1 ELSE NULL END) - COUNT(CASE WHEN p.PostTypeId = 1 THEN 1 ELSE NULL END)) AS [Disparity]
FROM PostsWithDeleted p
WHERE p.CreationDate < DATEFROMPARTS(YEAR(@SEDEUpdated), MONTH(@SEDEUpdated), 1) -- Only include months prior to latest SEDE update (incomplete data)
  AND p.PostTypeId IN (1,2) -- Limit posts to Qs & As
  AND p.CreationDate BETWEEN ##StartDate:string?7.1.2008## AND ##EndDate:string?1.1.2030##
GROUP BY DATEFROMPARTS(YEAR(p.CreationDate), MONTH(p.CreationDate), 1)
ORDER BY DATEFROMPARTS(YEAR(p.CreationDate), MONTH(p.CreationDate), 1) DESC

Enter Parameters

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