Q&A about the site for professional and independent game developers
WITH Prep AS ( SELECT Users.Id, CASE WHEN COUNT(p.Id) = 0 THEN '0' WHEN COUNT(p.Id) >= 1 AND COUNT(p.Id) <= 10 THEN '1-10' ELSE '>10' END AS Category FROM Users LEFT JOIN Posts p ON p.OwnerUserId = Users.Id GROUP BY Users.Id ) SELECT Category, ROUND(100.*COUNT(DISTINCT(Id))/(SELECT COUNT(DISTINCT(Id)) FROM USERS), 2) AS Percentage, COUNT(DISTINCT(Id)) AS 'Count' FROM Prep GROUP BY Category