Post count, view count, view/post ratio per day

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

DECLARE @TagName nvarchar (25) = '##TagName##'

SELECT TOP 112 
   CAST(p.CreationDate AS date) AS pdate,
   COUNT(*) AS nposts_per_day,
   SUM(p.ViewCount) AS nviews_per_day,
   SUM(p.ViewCount)/COUNT(*) AS view_post_ratio
   FROM Tags 
   JOIN PostTags AS pt ON Tags.Id = pt.TagId 
   JOIN Posts AS p ON pt.PostId = p.Id
   WHERE Tags.TagName = @TagName
   GROUP BY CAST(p.CreationDate AS date)
   ORDER BY pdate DESC

Enter Parameters

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