Top 100 Answerers for a Given Tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Joomla

Q&A for Joomla! administrators, users, developers and designers

SELECT TOP 5 Users.DisplayName, Tags.tagname, sum(Answers.Score) as Score
    
FROM Users
    JOIN Posts as Answers ON Answers.OwnerUserId = Users.Id
    JOIN Posts ON Posts.Id = Answers.ParentId
    JOIN PostTags ON PostTags.PostId = Posts.Id
    JOIN Tags ON Tags.Id = PostTags.TagId
WHERE
    Users.DisplayName IN (
    SELECT TOP 1000
    Users.DisplayName
FROM Tags    
    JOIN PostTags ON PostTags.TagId = Tags.Id
    JOIN Posts ON Posts.Id = PostTags.PostId 
    JOIN Posts as Answers ON Answers.ParentId = Posts.Id
    JOIN Users ON Users.Id = Answers.OwnerUserId
WHERE    
    Tags.TagName = '##TagName##'
GROUP BY 
    Users.Id, DisplayName
ORDER BY 
    sum(Answers.Score) DESC
    )
Group By
    Users.DisplayName, Tags.tagname
ORDER BY 
    sum(Answers.Score) DESC;

Enter Parameters

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