Most viewed question in a given tag per year


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select top ##NumberOfYears## Year(p.CreationDate) as Year, 
       p.Id as [Post Link], 
from Posts p
inner join PostTags pt ON p.Id = pt.PostId
inner join Tags t ON t.Id = pt.TagId
where p.PostTypeId = 1
and t.TagName = '##TagName##'
group by Year(p.CreationDate), p.Id, p.ViewCount
order by row_number() over (
  partition by Year(p.CreationDate)
  order by p.ViewCount desc

Enter Parameters

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