Reputation: 4555
I have a MySQL table containing 10 digit numbers. I need to add +1 in front of each via an UPDATE.
Let's say my SELECT statement looks like this:
SELECT *
FROM num_data
WHERE number REGEXP '^[0-9]{10}$'
How do I add +1 in front of each result of my query above?
Upvotes: 0
Views: 285
Reputation: 781300
Use CONCAT
to concatenate strings in MySQL.
UPDATE num_data
SET number = CONCAT('+1', number)
WHERE number REGEXP '^[0-9]{10}$'
Upvotes: 1