Q&A about the site for administrators, end users, developers and designers for Craft CMS
select year(creationdate) as [year], month(creationdate) AS [month], sum(viewcount) / count(p.id) as [average views], count(p.id) as QuestionCount, sum(viewcount) as ViewCount from posts p join posttypes pt on p.posttypeid = pt.id where year(creationdate) >= 2011 and pt.name = 'Question' group by year(creationdate), month(creationdate) order by year(creationdate), month(creationdate)