Blog Statistic – Query

Here is the query

select
count(*) as ‘Number of post’,
sum(totalviews) ‘Total # of web views’,
avg(totalviews) ‘Average # of web views’,
sum(aggviews) ‘Total # of Agg views’,
avg(aggviews) as ‘Average # of Agg Views’
from cs_Posts cs_Posts, cs_Sections SEC
where cs_Posts.SectionID = Sec.SectionID
and Groupid = 3
and postauthor = ‘Garth’ and cs_Posts.SectionID = 20
and postdate > ‘2007-04-01’

Leave a Reply

Your email address will not be published. Required fields are marked *