TOP USERS IN TAG GROUPED BY COUNTRY

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu Meta

Q&A about the site for Ubuntu users and developers

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
WHERE
    LOWER(Location) LIKE LOWER('%##countryname##%')
    AND t.tagname='##tagname##'
GROUP BY u.reputation, u.id
ORDER BY
    Reputation DESC;

Enter Parameters

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