Q&A for professional and enthusiast programmers
with answercounts as ( select count(*) as answercount from posts where parentid is not NULL group by parentid having count(*) > 0 ) SELECT answercount, COUNT(answercount), PERCENT_RANK() OVER (ORDER BY answercount) AS Percent_Rank from answercounts GROUP BY answercount order by percent_rank