Bounty to Reputation Comparison


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 Aggregate.UserId AS [User Link],
  FROM (SELECT Selection.UserId,
               CAST(Selection.TotalBounty AS FLOAT) AS TotalBounty,
               Selection.TotalBounty + Users.Reputation AS TotalReputation
          FROM (SELECT UserId,
                       sum(BountyAmount) AS TotalBounty
                  FROM Votes
                 WHERE VoteTypeId = (SELECT Id
                                       FROM VoteTypes
                                      WHERE Name = 'BountyStart')
                   AND BountyAmount != 0
                 GROUP BY UserId) Selection
          JOIN Users
            ON Users.Id = Selection.UserId
         WHERE Users.LastAccessDate > getdate() - 365
           AND Users.CreationDate < getdate() - 365
           AND Users.Reputation < 500) Aggregate
 ORDER BY Aggregate.TotalBounty / Aggregate.TotalReputation DESC,
          Aggregate.TotalReputation ASC;

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results