All User Tag Ranks by Location

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

SELECT
    ROW_NUMBER() OVER(ORDER BY SUM(p.score) DESC) AS [#], 
    p.OwnerUserId AS [User Link], 
    Max(u.Reputation) as [Total Reputation],
    SUM(p.score) as [Tag Repuation]
FROM Users u
JOIN Posts p ON p.OwnerUserId = u.Id
INNER JOIN Posts q on q.id = p.parentid
WHERE
    LOWER(u.Location) LIKE LOWER('%##CityName##%')
    AND p.posttypeid = 2 -- just answers
    AND q.tags like LOWER('%<##TagName##>%')
GROUP BY p.OwnerUserId
ORDER BY sum(p.score) DESC

Enter Parameters

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