Top Users by location and tag

4

Please login or register to vote for this query.

(click on this box to dismiss)

Created by samliew (http://stackoverflow.com/users/584192/samuel-liew)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Top Users by location and tag
-- Created by samliew (http://stackoverflow.com/users/584192/samuel-liew)

SELECT
TOP 100
    ROW_NUMBER() OVER(ORDER BY Reputation DESC) AS [#], 
    u.Id AS [User Link], 
    u.Reputation,
    count(p.id),
    sum(p.score) as [Tag Score]
FROM
    Users u
inner join posts p on p.ownerUserid = u.id
inner join posttags pt on pt.postid = p.id
inner join tags t on t.id = pt.tagid
WHERE
    LOWER(Location) LIKE LOWER('%##location##%')
    and t.tagname='##tagname##'
group by u.reputation, u.id
ORDER BY
    Reputation DESC;

Enter Parameters

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