Question count by the number of answers per question

0

Please login or register to vote for this query.

(click on this box to dismiss)

Engineering

Q&A for professionals and students of engineering

Select
    q.Cnt as AnswerCount,
    count(*) as QuestionCount,
    count(*) * 100.0 / min(TotalQuestions) as 'Percent'
from (
Select(
    Select count(*) from Posts a where a.PostTypeId = 1
  ) as TotalQuestions, (
    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

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results