Hello All.

I am hoping for a bit of help with some code that has really given me some trouble. If this is not he correct forum for this any help in pointing me to a more suited list would be appreciated.

I have a MySQL 4.1.x database containing records with phone numbers.

Most of the phone numbers are enter in 12035551212 format, but some are entered with spaces or "-" or "(" or other characters.

I need to read the first 4 positions in the phone number to determine it's location.

My statement looks like this:
'Select mid(phone, 1,4) as phoneareacode from phonetable'

This works but if the number is entered as 1(203)-555-1212 the above would return "1(20" which is not what I am looking for.

Is there a way to have the select statement examine only numeric values in the phone number so it would disregard the other charcters?

In Lasso, you can use a Replace with a Regular Expression function to have just the digits 0-9 examined but haven't been able find a way to do this in SQL.

Any help is appreciated.
Thank you.
Rick








--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to