Most Recent and Popular Tags in the Last Week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Webmasters

Q&A for pro webmasters

-- Enter Query Title
-- Enter Query Description

set nocount on 
-- Interesting Questions for a Tag in the last N days

declare @latest datetime
select @latest = dateadd(d, -7, CreationDate) from Posts where Id = (select max(Id) from Posts);

select top 20 TagName, Count(*) as PostCount from Tags 
  inner join PostTags on Tags.Id = PostTags.TagId 
  inner join Posts on PostTags.PostId = Posts.Id
where @latest <= Posts.CreationDate
group by Tagname
order by  SUM(7*24*60 + datediff(n, CreationDate, @latest)) DESC;

Enter Parameters

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