From: Jorge Bastos Date: July 3 2007 8:38am Subject: Fw: Stripping whitespace from a select List-Archive: http://lists.mysql.com/win32/18727 Message-Id: <2adb01c7bd4d$913ca270$0301a8c0@hercules.decimalint.pt> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit you can trim() the field to remove the spaces in the beginning and end os value ----- Original Message ----- From: "Leigh Sharpe" To: "win32" Sent: Tuesday, July 03, 2007 3:45 AM Subject: Stripping whitespace from a select 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 lsharpe@stripped web www.pacificwireless.com.au