Stripping whitespace from a select
"Leigh Sharpe" <[email protected]> Tue, 3 Jul 2007 12:45:03 +1000
| Newsgroups | gmane.comp.db.mysql.windows |
|---|---|
| Message-ID | <H0000069001cf74c.1183430700.mail.pacificwireless.net.au@MHS> |
Hi All,
I have a table which contains phone numbers. I want to extract these
phone numbers in a common format, but they have not been entered the
same way. Is there any easy way of removing whitespace and brackets in
one go? The best I can come up with so far is this rather ugly one:
SELECT REPLACE(REPLACE(REPLACE(REPLACE(phone_work,"(",""),")", "" ), "
", "" ),"-","") FROM contacts WHERE phone_work!="";
Which will remove all "(", ")", "-", and spaces. Suerly there's a better
way?
Regards,
Leigh
Leigh Sharpe
Network Systems Engineer
Pacific Wireless
Ph +61 3 9584 8966
Mob 0408 009 502
Helpdesk 1300 300 616
email [email protected]
web www.pacificwireless.com.au