Question views-per-day count distribution

0

Please login or register to vote for this query.

(click on this box to dismiss)

The distribution of views per day on questions (in blocks of size 1)

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- Question views-per-day count distribution
--
-- An ugly query to get the distribution of views per day on questions
-- (in blocks of size 1)

SELECT
    Count(*) AS NumQuestions,
    FLOOR(ViewCount / DateDiff(day,CreationDate,getdate()))+1 AS ViewsPerDay

FROM Posts

WHERE PostTypeId = 1

GROUP BY
    FLOOR(ViewCount / DateDiff(day,CreationDate,getdate()))+1

ORDER BY
    ViewsPerDay

Enter Parameters

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