H-index (based on answer scores) ranking per tag


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 row_number() over (order by max(H.Score) desc) as [#]
  , H.OwnerUserId as [User Link], max(H.Score) as HIndex
  , min(B.Class) as TagBadge
from (
  select S.OwnerUserId, S.Score
    , sum(S.NumAnswers)
      over (partition by S.OwnerUserId order by S.Score desc rows unbounded preceding)
      as NumAnswersCumul
  from (
    select P.OwnerUserId, P.Score, count(*) as NumAnswers
    from Posts P
    inner join PostTags PT on PT.PostId = P.ParentId
    inner join Tags T on T.Id = PT.TagId
    where P.PostTypeId = 2
        and P.Score >= ##MinScore?10##
        and P.OwnerUserId is not null
        and T.TagName = '##TagName?python##'
    group by P.OwnerUserId, P.Score
    ) S
  ) H
left outer join Badges B on B.UserId = H.OwnerUserId
where H.NumAnswersCumul >= H.Score
  and B.TagBased = 1
  and B.Name = '##TagName?python##'
group by H.OwnerUserId
order by HIndex desc

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results