Epic/Legendary Badges

6

Please login or register to vote for this query.

(click on this box to dismiss)

Tells you how often you hit the reputation cap (50 = Epic Badge, 150 Legendary Badge)

Ebooks

Q&A for ebook publishers and readers

-- Enter Query Title
-- Enter Query Description

DECLARE @UserId int = ##UserId##

SELECT SUM(Overvoted.SumVotes) AS 'Hit The Reputation Cap' FROM
(
SELECT SumVotes = CASE
                    WHEN SUM(AllVotes.Votes) >= 200 THEN 1                    
                    ELSE 0
                  END
FROM   (SELECT COUNT(*) * 10      as Votes,
               Votes.CreationDate AS CreationDate
        FROM   Posts
               INNER JOIN Votes
                 ON Votes.PostId = Posts.Id
                    and VoteTypeId = 2
        WHERE  Posts.OwnerUserId = @UserId
               AND Posts.CommunityOwnedDate IS NULL
        GROUP  BY Votes.CreationDate
        UNION
        SELECT COUNT(*) * -2      as Votes,
               Votes.CreationDate AS CreationDate
        FROM   Posts
               INNER JOIN Votes
                 ON Votes.PostId = Posts.Id
                    and VoteTypeId = 3
        WHERE  Posts.OwnerUserId = @UserId
               AND Posts.CommunityOwnedDate IS NULL
        GROUP  BY Votes.CreationDate) as AllVotes
GROUP  BY AllVotes.CreationDate 
) as OverVoted

Enter Parameters

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