Question score by time of day

0

Please login or register to vote for this query.

(click on this box to dismiss)

Questions with at least one answer, grouped by UTC hour.

Stack Overflow

Q&A for programmers

-- Question score by time of day
-- Questions with at least one answer, grouped by UTC hour.

SELECT 
    DATEPART(hour, CreationDate) AS [Hour],
    Count(*) AS [Total answered],
    Round(100.0 * Count(CASE WHEN Score < 0 THEN 1 END) / Count(*), 2) AS [% score<0],
    Round(100.0 * Count(CASE WHEN Score = 0 THEN 1 END) / Count(*), 1) AS [% score=0],
    Round(100.0 * Count(CASE WHEN Score = 1 THEN 1 END) / Count(*), 1) AS [% score=1],
    Round(100.0 * Count(CASE WHEN Score > 1 THEN 1 END) / Count(*), 1) AS [% score>1],
    Round(100.0 * Count(CASE WHEN Score < AnswerCount THEN 1 END) / Count(*), 1) AS [% score&lt;answers]
FROM Posts
WHERE PostTypeId = 1 AND AnswerCount >= 1
GROUP BY DatePart(hour, CreationDate)
ORDER BY DatePart(hour, CreationDate)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached