Number of open, closed and deleted questions by month

1

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics

Q&A for people studying math at any level and professionals in related fields

SELECT
  DATEFROMPARTS(
    DATEPART(yyyy, CreationDate),
    DATEPART(mm, CreationDate),
    1) AS Month,
  COUNT(DeletionDate) AS Deleted,
  COUNT(CASE
    WHEN DeletionDate IS NOT NULL OR ClosedDate IS NOT NULL THEN 1
    ELSE NULL
  END) AS ClosedOrDeleted,
  COUNT(*) AS AllQuestions/*
  COUNT(CASE
    WHEN DeletionDate IS NULL AND ClosedDate IS NULL THEN 1
    ELSE NULL
  END) AS [Open]*/
FROM PostsWithDeleted
WHERE PostTypeId=1
GROUP BY DATEFROMPARTS(
    DATEPART(yyyy, CreationDate),
    DATEPART(mm, CreationDate),
    1)
ORDER BY Month

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results