Top users by offered bounties in 2017

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

SELECT TOP(100)
  ROW_NUMBER() OVER (ORDER BY SUM(Votes.BountyAmount) DESC, Users.ID) AS rnSum
  ,ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC, Users.ID) AS rnCount
  ,Users.ID
  ,Users.DisplayName
  ,Users.Reputation
  ,SUM(Votes.BountyAmount) AS BountyOfferedTotal
  ,COUNT(*) AS BountyOfferedCount
FROM
  Votes
  INNER JOIN Posts ON Posts.ID = Votes.PostID
  INNER JOIN Users ON Users.ID = Posts.OwnerUserID
WHERE
  Votes.BountyAmount IS NOT NULL
  AND Votes.VoteTypeID = 8 -- BountyStart
  AND Posts.PostTypeID = 1 -- Question
  AND Votes.CreationDate between '01/01/2017' AND '12/31/2017'
GROUP BY
  Users.ID
  ,Users.DisplayName
  ,Users.Reputation
ORDER BY BountyOfferedTotal DESC, Users.ID
;

Enter Parameters

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