Question creation / rejection rate

1

Please login or register to vote for this query.

(click on this box to dismiss)

Question is rejected if it goes closed or deleted. If the question is closed and deleted, the earlier counts.

The Great Outdoors

Q&A for people who love being outdoors enjoying nature and wilderness, and learning about the required skills and equipment

WITH Raw AS (
  SELECT 'Created' AS EventType, Id, CreationDate AS TS
  FROM PostsWithDeleted
  WHERE PostTypeId = 1

  UNION

  SELECT
    'Closed/Deleted' AS EventType,
    Id,
    CASE
      WHEN ClosedDate IS NOT NULL AND DeletionDate IS NOT NULL
      THEN
        CASE
          WHEN ClosedDate > DeletionDate THEN DeletionDate
          ELSE ClosedDate
        END
      WHEN ClosedDate IS NOT NULL THEN ClosedDate
      ELSE DeletionDate
    END AS TS
  FROM PostsWithDeleted
  WHERE
    ClosedDate IS NOT NULL OR DeletionDate IS NOT NULL
    AND
    PostTypeId = 1
)
SELECT
  DATEFROMPARTS(
    DATEPART(yyyy, TS),
    DATEPART(m, TS),
    1) AS Month,
  EventType,
  COUNT(*) AS Count
FROM Raw
GROUP BY EventType,
  DATEFROMPARTS(
    DATEPART(yyyy, TS),
    DATEPART(m, TS),
    1)
ORDER BY Month, EventType

Enter Parameters

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