Q&A about the site for developers and end users of the Sitecore CMS and multichannel marketing software
/***Number of Day you hit the Reputation Cap ***/ DECLARE @UserID int Set @UserID = 519413; 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