Top users by tag and location - Sample

0

Please login or register to vote for this query.

(click on this box to dismiss)

Academia Meta

Q&A about the site for academics and those enrolled in higher education

SELECT ROW_NUMBER() OVER(ORDER BY tuser.TagScore DESC) AS [#], 
       DisplayName,
       Id,
       Reputation,
       tuser.TagScore AS [Tag Score],
       WebsiteURL,
       Location,
       UpVotes,
       DownVotes,
       LastAccessDate

FROM Users

JOIN 
(SELECT Answers.OwnerUserId AS UserId, SUM(Answers.Score) AS TagScore
     FROM Tags 
    JOIN PostTags ON Tags.Id = PostTags.TagId
    JOIN Posts ON Posts.Id = PostTags.PostId  
    JOIN Posts Answers ON Answers.ParentId = Posts.Id 
    WHERE LOWER(Tags.TagName) like '%##TagName##%'
  GROUP BY Answers.OwnerUserId
) tuser ON tuser.UserId = Users.Id

WHERE (Location) like '%##San Francisco##%'

Enter Parameters

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