Percentage of question deletions with upvoted answers in all question deletions, monthly

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

WITH Raw AS (
  SELECT
    Q.Id,
    DATEFROMPARTS(
      DATEPART(yyyy, MIN(Q.DeletionDate)),
      DATEPART(m, MIN(Q.DeletionDate)),
      1) Month,
    CASE WHEN MAX(A.Score) > 0 THEN 1 ELSE NULL END AS HasUpvotedAnswers
  FROM PostsWithDeleted Q
  LEFT JOIN PostsWithDeleted A ON A.ParentId = Q.Id
  WHERE
    Q.DeletionDate IS NOT NULL
  GROUP BY Q.Id
)
SELECT
  Month,
  100.0 * COUNT(HasUpvotedAnswers)/COUNT(*) AS Pct
  --COUNT(*) AS TotalQDeletions,
  --COUNT(HasUpvotedAnswers) AS HasUpvotedAnswers
FROM Raw
GROUP BY Month
ORDER BY Month

Enter Parameters

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