DECLARE @BadgeName AS NVARCHAR(50) = ##BadgeName:string?E...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Sports

Q&A for participants in team and individual sport activities

DECLARE @BadgeName AS NVARCHAR(50) = ##BadgeName:string?Enlightened##;
DECLARE @MyTop AS INT = ##MyTop:int?100##;

SELECT TOP(@MyTop)
    Badges.UserId AS [User Link],
    Users.Reputation,
    @BadgeName AS BadgeName,
    COUNT(Badges.Id) AS NumberOfBadges
FROM  Badges 
  INNER JOIN Users ON Users.Id=Badges.UserId
WHERE Badges.Name = @BadgeName
  AND Users.Reputation > 10000 
  AND Users.Location = 'South Africa'
GROUP BY Badges.UserId, Users.Reputation
ORDER BY NumberOfBadges DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results