Top answerers grouped by Tag

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 TagUsers as (
SELECT
  Answers.OwnerUserId AS [User Link]
, Tags.TagName
, COUNT(Tags.TagName) as [Count]
FROM Posts AS Answers
  INNER JOIN PostTags ON ParentId = PostTags.PostId
  INNER JOIN Tags ON PostTags.TagId = Tags.Id
where Answers.PostTypeId = 2
GROUP BY
  Tags.TagName
, Answers.OwnerUserId
)
select *
from TagUsers head
where not exists (
    select 1
    from TagUsers sub
    where sub.TagName = head.TagName
    and sub.Count > head.Count)
order by Count DESC

Enter Parameters

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