Users with highest badgesCount / rep ratio who didn't spend rep on bounties

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT TOP 10 UserId AS [User Link],
      (SELECT Reputation FROM Users WHERE Id=UserId) AS Reputation,
      COUNT(*) AS [Total Badges],
      cast(Count(*) as float)/(SELECT Reputation FROM Users WHERE Id=UserId) As Ratio
    FROM Badges
    WHERE ((SELECT Reputation FROM Users WHERE Id=UserId) >= ##MinScore:int##)
    AND
    ((SELECT SUM(BountyAmount) FROM Votes WHERE Votes.UserId = Badges.UserId) is null)
    GROUP BY UserId
    ORDER BY Ratio DESC

Enter Parameters

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