Altruistic Bounties Offered Rank by User

0

Please login or register to vote for this query.

(click on this box to dismiss)

Health Meta

Q&A about the site for professionals in medical and allied health fields, students of those professions, related academics, and others with a sound understanding of medicine and healthcare-related sciences

WITH RankedUsers AS (
  SELECT RANK() OVER (ORDER BY SUM(v.BountyAmount) DESC) AS Rank,
         v.UserId,
         SUM(v.BountyAmount) AS BountySum
  FROM Votes v
  JOIN Posts p ON v.PostId = p.Id
              AND v.UserId != p.OwnerUserId   -- only other people's posts
  WHERE VoteTypeId = 8                        -- (8=BountyOpen)
    AND UserId != -1
  GROUP BY v.UserId
)
SELECT Rank,
       UserID AS [User Link],
       BountySum
FROM RankedUsers
WHERE Rank < 100
   OR UserID = ##UserId##
ORDER BY Rank

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results