'Copy information from one column to another with a condition
I have the following table I want the PHONE NUMBER column information to be copied to the OLD PHONE NUMBER column provided the US telephone format is followed FORMAT USA
Solution 1:[1]
You could just check which rows have a valid phone number and dann asign them in a single update like this:
UPDATE SET OLD_PHONE_NUMBER = PHONE_NUMBER WHERE PHONE_NUMBER REGEXP '^\([0-9]{3}\) [0-9]{3}\-[0-9]{4}$'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Johannes Krackowizer |
