High Rated Users Count - modified

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow на русском

Вопросы и ответы для программистов

select datepart(year, uba.[Answer Creation Date]) as [Year],
 datepart(month, uba.[Answer Creation Date]) as [Month],
 count(distinct uba.[Owner]) as [High Rated Users Count]
from (select min(a.CreationDate) as [Answer Creation Date], 
    count(*) as [Upvotes Count],
    min(a.OwnerUserId) as [Owner]
    from Votes v
    inner join Posts a on v.PostId = a.Id
    inner join Posts q on a.ParentId = q.Id 
    where v.VoteTypeId = 2
    and a.PostTypeId = 2
    and datediff(day, a.CreationDate, v.CreationDate) <= 30
    and (select count(*)
       from PostTags pt
       inner join Tags t on pt.TagId = t.Id
       where pt.PostId = q.Id
         and t.TagName = '##tagName##') > 0
    group by v.PostId) uba
where uba.[Upvotes Count] >= ##minScore##
group by datepart(year, uba.[Answer Creation Date]),
  datepart(month, uba.[Answer Creation Date])
order by [Year], [Month]

Enter Parameters

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