List of Most reputed users in a given location - Case Sensitive

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gets a list of most reputed users from a given location.

GenAI Meta

Q&A for GenAI enthusiasts and practitioners and those interested in learning more about using GenAI tools

SELECT * FROM
(SELECT TOP 100 
   'Gold' AS [Type],
   UserId AS [User Link],
   Count(*) as [Count]
FROM Badges b
INNER JOIN users u ON u.id = b.userid
      WHERE location like '%##Location##%' AND Class=1
GROUP BY UserId
ORDER BY [Count] DESC
) g

UNION ALL
SELECT * FROM (
SELECT TOP 10 
   'Silver' AS [Type],
   UserId AS [User Link],
   Count(*) as [Count]
FROM Badges b
INNER JOIN users u ON u.id = b.userid
      WHERE location like '%##Location##%' AND Class=2
GROUP BY UserId
ORDER BY [Count] DESC
) s
UNION ALL
SELECT * FROM (
SELECT TOP 10 
   'Bronze' AS [Type],
   UserId AS [User Link],
   Count(*) as [Count]
FROM Badges b
INNER JOIN users u ON u.id = b.userid
      WHERE location like '%##Location##%' AND Class=3
GROUP BY UserId
ORDER BY [Count] DESC
) b

Enter Parameters

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