Gets a list of most reputed users from a given location.
Q&A about the site for administrators, end users, developers and designers for Craft CMS
SELECT * FROM (SELECT TOP 1800 'Gold' AS [Type], UserId AS [User Link], Count(*) as [Count], u.CreationDate as [CreationDate], u.Reputation as [Reputation] FROM Badges b INNER JOIN users u ON u.id = b.userid WHERE location like '%##Location##%' AND Reputation>1500 AND Class=1 GROUP BY u.Reputation, u.CreationDate, UserId ORDER BY [Count] DESC ) g