Hi All,
I run a online game, and sometimes a player will have neg stats. This is now causing neg score for neg stats.
I would like to cap this at 0 if the stat is neg, but im not sure where I am going wrong.
This is what I have so far.
update #p set cashStealScore = @baseStealValue * b.score/@topCash * .4
from #rankCashSteals b
where #p.playerid = b.playerid
Any help would be great!
Thanks
Anthony
I think what you want to do is to use a CASE statement to evaluate the b.score: if it's less than zero use zero, else use the b.score
update #p
SET cashStealScore = @baseStealValue * CASE
WHEN b.score < 0 THEN 0
ELSE b.score
END/@topCash * .4
from #rankCashSteals b
where #p.playerid = b.playerid
Lowell
December 20, 2020 at 1:07 pm
Hi Lowell
Oh my gosh! This worked perfectly!
Thank you SO much!
Anthony.
December 22, 2020 at 12:21 pm
This was removed by the editor as SPAM
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply