Legendary Badge Calculation

0

Please login or register to vote for this query.

(click on this box to dismiss)

Legendary Badge Calculation

Physics

Q&A for active researchers, academics and students of physics

DECLARE @UserID int 
Set @UserID = 1730272;
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