with relevant_questions as ( select Posts.Id, Title, Tags...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

with relevant_questions as (
  select Posts.Id, Title, Tags, Year(CreationDate) CreationYear, Month(CreationDate) CreationMonth, Score
  from Posts
  inner join PostTags on Posts.Id = PostTags.PostId
  inner join Tags on Tags.Id = PostTags.TagId
  where Tags.TagName = 'r'
  and PostTypeId = 1
  and Score > 0
  and Year(CreationDate) >= 2008  
),
ranked_questions as (
  select relevant_questions.*, dense_rank()
  over (partition by CreationYear, CreationMonth order by Score desc) ScoreRank
  from relevant_questions
)
select Id, Title, Tags, CreationYear, CreationMonth, Score
from ranked_questions
where ScoreRank <= 1
order by CreationYear, CreationMonth, Score desc

Enter Parameters

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