Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dr. Who needs assistance

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Is there a way to phrase a MySQL query so that if the user searches for "dr who" it will find a match for "dr. who" and vice-versa?

- Andy
___________________________________________________________________
If a man speaks in a forest and there are no women around to hear him - will he still be wrong?
 
it would take some fancy footwork using your application language to parse the words in the search string

for instance,

WHERE somecolumn LIKE '%dr%who%'

will find 'dr. who'

but you have to write a reasonably smart parser, and that's not really a mysql issue

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Hi

For just one character [tt]replace()[/tt] may be more efficient :
Code:
[b]where[/b] replace[teal]([/teal]somecolumn[teal],[/teal][green][i]'.'[/i][/green][teal],[/teal][green][i]''[/i][/green][teal])=[/teal]replace[teal]([/teal][green][i]'dr. who'[/i][/green][teal],[/teal][green][i]'.'[/i][/green][teal],[/teal][green][i]''[/i][/green][teal])[/teal]


Feherke.
 
Thanks for the ideas!

- Andy
___________________________________________________________________
If a man speaks in a forest and there are no women around to hear him - will he still be wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top