Top Users by Country

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)

スタック・オーバーフローMeta

プログラマーと熱狂的なプログラマーのためのサイトに関する質問と回答

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

SELECT
    ROW_NUMBER() OVER(ORDER BY u.Reputation DESC) AS [#], 
    u.Id AS [User Link], 
    u.Reputation
FROM
    Users u
INNER JOIN Comments c ON u.Id = c.UserId
INNER JOIN Posts p ON p.Id = c.PostId
INNER JOIN PostTags pt ON pt.PostId = p.Id
INNER JOIN Tags t ON pt.TagId = t.Id
WHERE
    LOWER(u.Location) LIKE LOWER('%##CountryName##%')
    AND
    LOWER(t.TagName) LIKE LOWER('%##TagName##%')
GROUP BY u.Id, u.Reputation
ORDER BY
    Reputation DESC;

Enter Parameters

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