Distribution of posts from a given year by time of day

0

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 WHERE DATEPART(YYYY, CreationDate) = ##year:int##)
    , data AS(SELECT Hour, Id, COUNT(*) AS Num FROM post GROUP BY Id, Hour)
    , totals AS(SELECT COUNT(*) AS Num, Id FROM post GROUP BY Id)
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

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