Question: Limit search on string

2004-12-01 Thread Stuart Felenstein
I'm storing telephone number (US) in 10 digit varchars. If I want to do a search on just the area code, is there a way to limit it to just the first 3 digits of the string ? Thank you Stuart -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: Question: Limit search on string

2004-12-01 Thread Stuart Felenstein
--- Stuart Felenstein [EMAIL PROTECTED] wrote: I'm storing telephone number (US) in 10 digit varchars. If I want to do a search on just the area code, is there a way to limit it to just the first 3 digits of the string ? Thank you Stuart I'm trying something like this but still

Re: Question: Limit search on string

2004-12-01 Thread Roger Baklund
Stuart Felenstein wrote: I'm storing telephone number (US) in 10 digit varchars. If I want to do a search on just the area code, is there a way to limit it to just the first 3 digits of the string ? I'm trying something like this but still getting back the whole string: select Telephone from

Re: Question: Limit search on string

2004-12-01 Thread Stuart Felenstein
--- sol beach [EMAIL PROTECTED] wrote: Of course you do. You are asking for all of Telephone to be returned. Duh! I'm trying something like this but still getting back the whole string: select Telephone from SignUp where Left (SUBSTRING(Telephone,1,3), 3) LIKE '4%'

Re: Question: Limit search on string

2004-12-01 Thread Stuart Felenstein
--- Roger Baklund [EMAIL PROTECTED] wrote: It's a bit unclear what you are trying to do. Are you trying to find all numbers within a 3 digit area code, i.e. numbers starting with some 3 digits? Or are you trying to find numbers with any of the three first digits equal to 4? For the

Re: [SOLVED]Question: Limit search on string

2004-12-01 Thread Stuart Felenstein
--- Stuart Felenstein [EMAIL PROTECTED] wrote: --- Roger Baklund [EMAIL PROTECTED] wrote: Yes, I had not included in my original post I wanted just the area code returned. It works - select SUBSTRING(Telephone, 1 ,3) from SignUp where Left (Telephone, 3) LIKE '4%' ; Thank you Stuart