Total rep from answers: upvotes, downvotes, accepts, bounties (repcap ignored)


Please login or register to vote for this query.

(click on this box to dismiss)


Q&A for those using, extending or developing Emacs

-- Legendary Badge advancement
-- Retrieve details on the race to legendary for all site users.

DECLARE @UserId INT = ##UserId##

SELECT UserId as [User Link],
       sum(RepChange) as [Rep]
  FROM (
          CASE VoteTypeId
              WHEN 1 THEN 15
              WHEN 2 THEN 10
              WHEN 3 THEN -2
              WHEN 9 THEN BountyAmount
              END RepChange,
      Posts.OwnerUserId UserId
      FROM Votes
          INNER JOIN Posts ON Posts.Id = Votes.PostId
      WHERE VoteTypeId IN (1,2,3,9)
          AND Posts.OwnerUserId = @UserId
          AND Posts.PostTypeId = 2
          AND Posts.CommunityOwnedDate IS NULL
  ) v GROUP BY UserId

Enter Parameters

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