Highest percentage of rep in bounties - only counting questions which are not deleted

1

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans

Q&A for music historians, critics, and fans

SELECT TOP(##num?100##)
  RANK() OVER(ORDER BY ROUND((CAST(SUM(v.BountyAmount) AS decimal))*100.0/(CAST(u.Reputation+SUM(v.BountyAmount) AS decimal)),2) DESC) AS Rank,
  ROUND((CAST(SUM(v.BountyAmount) AS decimal))*100.0/(CAST(u.Reputation+SUM(v.BountyAmount) AS decimal)),2) AS percentage,
  v.UserId AS [User Link],
  u.Reputation,
  SUM(v.BountyAmount) AS [Bounty Amount],
  CAST(u.Reputation+SUM(v.BountyAmount) AS Integer) AS [Rep including bounties],
  COUNT(v.BountyAmount) AS [Bounty Count]
FROM PostsWithDeleted q INNER JOIN Votes v ON v.PostId=q.Id
  INNER JOIN Users u ON u.Id=v.UserId
WHERE (v.VoteTypeId=8) --BountyStart
  AND (q.DeletionDate IS NULL)
GROUP BY v.UserId, u.Reputation
HAVING ((SUM(v.BountyAmount)>=##minbounties?1000##) AND (u.Reputation>=##min?50##))
ORDER BY ROUND((CAST(SUM(v.BountyAmount) AS decimal))*100.0/(CAST(u.Reputation+SUM(v.BountyAmount) AS decimal)),2) DESC

Enter Parameters

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