Self-Answer Time Posted Stats

1

Please login or register to vote for this query.

(click on this box to dismiss)

A breakdown of when self-answers are posted on self-answered questions. An input is provided to generate a user-defined minute interval, in addition to an overall total. Each category has both a percentage and straight total.

Emacs

Q&A for those using, extending or developing Emacs

WITH SelfAnswers AS (
  SELECT q.Id, DATEDIFF(mi, q.CreationDate, a.CreationDate) AS [Minutes]
  FROM Posts AS q
  JOIN Posts a ON a.ParentId = q.Id AND a.OwnerUserID = q.OwnerUserId
)

SELECT
  1 AS [X],
  CONCAT('Within ', ##Minutes?15:int##, ' Minutes') AS [Timeframe],
  COUNT(CASE WHEN Minutes <= ##Minutes?15:int## THEN Id ELSE NULL END) AS [Total],
  AVG(CASE WHEN Minutes <= ##Minutes?15:int## THEN 100 ELSE 0 END) AS [Percent]
FROM SelfAnswers
UNION ALL
SELECT
  2 AS [X],
  'Total' AS [Timeframe],
  COUNT(Id) AS [Total],
  100 AS [Percent]
FROM SelfAnswers
ORDER BY X

-- Minutes: Interval Between Q & Self-Answer (in Minutes):

Enter Parameters

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