Weekly Snapshot of Views by Tagged Posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping

Q&A for gardeners and landscapers

DECLARE @Tag nvarchar(25) = '##Tag##';

SELECT
   WeekStart, SUM(UniqueId)
FROM 
(
  SELECT
    Posts.ViewCount AS UniqueId, 
    dateadd(week, datediff(day, '20000109', Posts.CreationDate) / 7, '20000109') AS WeekStart  
  FROM Tags
    INNER JOIN PostTags ON PostTags.TagId = Tags.Id
    INNER JOIN Posts ON Posts.Id = PostTags.PostId
  WHERE
    Tags.TagName = @Tag and
    Posts.PostTypeId = 1 -- Questions
) RelevantQuestionsByWeek
GROUP BY WeekStart;

Enter Parameters

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