Is it possible in mysql to replace the first character of a cell with something else?
eg I have
64123
64340
64067
0104
0240
0456
I need to replace all the starting 0's with 64
how could I do this?
UPDATE action_4_members
SET mobile = CONCAT('64', SUBSTRING(mobile,2))
WHERE SUBSTRING(mobile,1,1) = '0'
UPDATE action_4_members SET mobile = (IF SUBSTRING(mobile,0,1) == "0" THEN CONCAT("64", SUBSTRING(mobile,1)) ELSE mobile); but I get syntax error near 'SUBSTRING(mobile,0,1) == "0" THEN CONCAT("64", SUBSTRING(mobile,1)) ELSE mobile)'UPDATE action_4_members SET mobile` = CONCAT("64", SUBSTRING(mobile,1)) WHERE SUBSTRING(mobile,0,1) = '0';` But its not updating any rows.
0only if it is the first char?