I need to search a table for certain area codes. Because the office does not have a uniform way of entering phone numbers into the database, some are entered as (555)555-5555 and others as 555-555-5555.
I have a select statement in which I want to return phone numbers beginning with a certain area code indepent of how the phone number was entered.
I've tried the following:
but it does not work. If I remove the OR and search for only phone numbers with () or without()the SQL works.
Any ideas on how I can implement this would be greatly appreciated.
I have a select statement in which I want to return phone numbers beginning with a certain area code indepent of how the phone number was entered.
I've tried the following:
Code:
SELECT customers_telephone FROM customers WHERE customers_groups_id = 3 AND customers_telephone
like '(310)%' OR customers_telephone
like '310%'
but it does not work. If I remove the OR and search for only phone numbers with () or without()the SQL works.
Any ideas on how I can implement this would be greatly appreciated.