If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Find Matches Between Partial Names

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-10, 18:59
kierheyl kierheyl is offline
Registered User
 
Join Date: Dec 2007
Posts: 14
Find Matches Between Partial Names

Recently one of my co-workers put in a request for a project so she could pull cities for a state by a letter range in a report she uses. For example give me all cities in a California that start with between a and g. This was easy enough to do with a regular expression.

where city regexp '^[a-gA-G]'

Then she came back to me and said that there were too many s's in our report for California because of all the cities that start with san or santa. So she needs a way to further divide the cities up and wanted to know if it would be possible to filter cities where the city name falls between San Francisco and San Jose. I started working towards this and realized that it is a much more complicated issue. Is there a moderately easy way to handle this kind of lookup or will I need to look in to alternate filtering methods?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 02-25-10, 13:10
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 435
Why not simply:

Code:
WHERE city between 'San Francisco' and 'San Jose'
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On