I'm trying to create an SQL query to set a number in a column if another number is present
UPDATE vrp_user_moneys
SET
when bank = 0 then SET bank = 500000 ELSE bank end
I've had a look around but to no luck, how would i correct this query? Thanks!
CodePudding user response:
I think you want:
UPDATE vrp_user_moneys
SET bank = 500000
WHERE bank = 0;
CodePudding user response:
The syntax are wrong. Try this
UPDATE vrp_user_moneys as v
SET v.bank = 500000
WHERE v.bank = 0;
try this and next time please also the tables structure, thanks