Distribution of posts by time of day


Please login or register to vote for this query.

(click on this box to dismiss)

TeX - LaTeX

Q&A for users of TeX, LaTeX, ConTeXt, and related typesetting systems

WITH post AS(SELECT DATEPART(HH, CreationDate) AS Hour, PostTypeId AS Id FROM Posts)
    , data AS(SELECT Hour, Id, COUNT(*) AS Num FROM post GROUP BY Id, Hour)
    , totals AS(SELECT COUNT(*) AS Num, PostTypeId AS Id FROM Posts GROUP BY PostTypeId)
SELECT Hour, PostTypes.Name, data.Num * 1. / totals.Num AS Activity FROM data JOIN totals ON data.Id = totals.Id JOIN PostTypes ON data.Id = PostTypes.Id WHERE totals.Num > 10000 ORDER BY PostTypes.Id, Hour;

Enter Parameters

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