Distribution of HNQs based on time until entering - divided by n minutes

1

Please login or register to vote for this query.

(click on this box to dismiss)

Raspberry Pi

Q&A for users and developers of hardware and software for Raspberry Pi

;with times_cte AS (
SELECT
p.Id AS pid,
p.CreationDate AS cre,
ph.CreationDate AS hot,
FLOOR(CAST(DATEDIFF(minute, p.CreationDate, ph.CreationDate) AS decimal)/##interval?10##) AS time
FROM PostHistory ph INNER JOIN Posts p ON ph.PostId=p.Id
WHERE ph.PostHistoryTypeId=52
---52 = Question became hot network question
)

SELECT
  time,
  COUNT(pid) AS Count
FROM times_cte
GROUP BY time
ORDER BY time

Enter Parameters

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