Times 200 was reached (Legendary Badge)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Legendary Badge Calculation

Music Fans

Q&A for music historians, critics, and fans

DECLARE @UserID int 
Set @UserID = 952747;
WITH BaseQuery AS (
SELECT dateadd(dd,0, datediff(dd,0, v.CreationDate)) as Day, SUM(CASE when VoteTypeId=1 then 15 when VoteTypeId=2 then 10 else -2 end) as Reputation 
FROM votes v
INNER JOIN posts p on p.Id=v.PostId And p.CommunityOwnedDate is null
WHERE v.VoteTypeId=2 and p.OwnerUserId=@UserID 
GROUP BY dateadd(dd,0, datediff(dd,0, v.CreationDate))
HAVING SUM(CASE when VoteTypeId=1 then 15 when VoteTypeId=2 then 10 else -2 end) >= 200)

SELECT count(*) FROM BaseQuery

Enter Parameters

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