I've got a database table with a couple of hundred thousand records. The table has a unique field, "tel1" which holds telephone numbers (as a varchar).
Some of the numbers are formatted with spaces, i.e. "0845 000 0000"
and some aren't i.e. "08450000000".
I'd like to remove all the spaces, and any duplicate records.
I've tried
but that gives an error if there is a duplicate record (because tel1 is unique).
Any way around this?
Some of the numbers are formatted with spaces, i.e. "0845 000 0000"
and some aren't i.e. "08450000000".
I'd like to remove all the spaces, and any duplicate records.
I've tried
Code:
UPDATE table SET tel1 = replace(tel1, " ", "");
but that gives an error if there is a duplicate record (because tel1 is unique).
Any way around this?