Top Users by Country and tag

0

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)

Russian Language

Q&A for students, teachers, and linguists wanting to discuss the finer points of the Russian language

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

SELECT
    ROW_NUMBER() OVER(ORDER BY Reputation DESC) AS [#], 
    u.Id AS [User Link], 
    u.Reputation,
    count(p.id)
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
inner join tags t2 on t.id = pt.tagid
WHERE
    LOWER(Location) LIKE LOWER('%##countryname##%')
    and t.tagname='##tagname##'
    and t2.tagname='##tagname2##'
group by u.reputation, u.id
ORDER BY
    Reputation DESC;

Enter Parameters

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