Q&A for professional and enthusiast programmers
Select q.Cnt as AnswerCount, count(*) as QuestionCount --, --count(*) * 100.0 / (select count(*) from Posts a where a.PostTypeId = 2) as Percent from ( Select q.Id as Id, ( Select count(*) from Posts a where a.ParentId = q.Id and a.PostTypeId = 2 ) as Cnt from Posts q where q.PostTypeId = 1 ) as q group by q.Cnt order by q.Cnt