Generating Blog Stats for Community Server
For those of you running Community Server who have access to the back-end database and would like to generate some stats like those I posted yesterday, here's "one query to rule them all":
select top 20 p.PostID, p.Subject, p.TotalViews, count(c.PostID) from cs_posts p with (nolock) left join cs_posts c with (nolock) on c.ParentID = p.PostID and c.ApplicationPostType = 4 where p.SectionID = 3 -- change this to your blog's SectionID and p.ApplicationPostType = 1 and year(p.PostDate) = 2006 group by p.PostID, p.Subject, p.TotalViews order by 3 desc
This query will give you the top 20 most-viewed posts for your blog in 2006. You'll have to look in the cs_Sections table to determine which SectionID your blog is.
If you change that last line so that it reads: "order by 4 desc" and re-run the query, you'll have the top 20 most-commented posts in 2006.
Start posting stats, guys!
# Trackback from Dave Burke on 6/01/2007 7:19 AM
# Trackback from Daily News List Blog on 7/01/2007 5:01 PM
# Trackback from Community Server Bits on 12/03/2007 4:27 PM