Q&A for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing
-- Find Stack Overflow Top N User in the Country -- TIEs are included SELECT RankNo, [User Link], Reputation, DisplayName, Location FROM ( SELECT Id [User Link], Reputation, DisplayName, Location, DENSE_RANK() OVER (ORDER BY Reputation DESC) RankNo FROM Users WHERE UPPER(Location) like UPPER('%##Location##%') ) derievedtable WHERE RankNo <= ##MaximumRankNo## ORDER BY RankNo