Top 20 viewed tag in the last 30 days

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

select top(20) t.TagName,sum(p.ViewCount) Views from posts p 
  join posttypes pt on p.posttypeid=pt.id
  join posttags ptag on p.id = ptag.postid
  join Tags t on t.Id = ptag.tagid
  where pt.Name='Question' and 
  DATEDIFF(day,p.lasteditdate,getdate())<=30
  group by t.TagName
  order by Views desc

Enter Parameters

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