[ad_1]
one
update wallet
SET coin=coin-(least(coin,500))
where userId=101;
or the other maybe
update wallet
SET coin=case when coin < 500 then 0 else coin-500 end
where userId=101;
[ad_2]
solved How can i modify this sql for execute?
[ad_1]
one
update wallet
SET coin=coin-(least(coin,500))
where userId=101;
or the other maybe
update wallet
SET coin=case when coin < 500 then 0 else coin-500 end
where userId=101;
[ad_2]
solved How can i modify this sql for execute?