Question score against number of answers

0

Please login or register to vote for this query.

(click on this box to dismiss)

The distribution of scores on questions, by answer count

Stack Overflow

Q&A for professional and enthusiast programmers

-- Question score against number of answers
-- The distribution of scores on questions, by answer count

SELECT 
    AnswerCount As [Answers],
    Count(*) AS [#Questions],
    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 = 2 THEN 1 END) / Count(*), 1) AS [% score=2],
    Round(100.0 * Count(CASE WHEN Score = 3 THEN 1 END) / Count(*), 1) AS [% score=3],
    Round(100.0 * Count(CASE WHEN Score > 3 THEN 1 END) / Count(*), 1) AS [% score>3]
FROM Posts
WHERE PostTypeId = 1 AND AnswerCount >= 0
GROUP BY AnswerCount
ORDER BY AnswerCount

Enter Parameters

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