Average Questions per Answer

1

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

select dateadd(week, datediff(week, 0, creationdate), 0), 
avg(isnull(answers.numanswers, 0)) as [AvgAnswersPerQ]
from posts
left outer join
(
select parentid, count(*) as numanswers
from posts
where posttypeid = 2
group by parentid

) as answers on posts.id = answers.parentid
where creationdate >= '1/1/2011' and posttypeid = 1
group by dateadd(week, datediff(week, 0, creationdate), 0)
order by dateadd(week, datediff(week, 0, creationdate), 0)

Enter Parameters

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