WITH T1 AS ( SELECT COUNT(*) AS C, Score FROM Posts WHERE...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

WITH T1 AS
(
SELECT COUNT(*) AS C,
       Score
FROM Posts
WHERE PostTypeId=1
GROUP BY Score
), T2 AS
(
SELECT *,
ROUND(100.0 * C / SUM(C) OVER(),1) AS Pct
FROM T1
)
SELECT *
FROM T2
WHERE Score BETWEEN -11 AND 11
ORDER BY Score

Enter Parameters

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