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;
solved How can i modify this sql for execute?
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;
solved How can i modify this sql for execute?