We are currently storing a load of customer mobile numbers, however most of them are missing the leading 0.
How can I add a 0 in SQL to the front of all mobile numbers where the first digit equals 7?
CodePudding user response:
You may use LIKE
here:
UPDATE yourTable
SET mobile = '0' mobile
WHERE mobile LIKE '7%';
CodePudding user response:
You can write a concat statement
update table
set yourcolumn = CONCAT('0', yourcolumn)
where yourcolumn like '7%'