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 > Searching partial strings with SOUNDEX()

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-05, 21:19
mkaminski mkaminski is offline
Registered User
 
Join Date: Oct 2005
Posts: 1
Searching partial strings with SOUNDEX()

Hello-

I have done hours of searching and can not find a solution to my problem. I am attempting to do a search of usernames in a mySQL database.

For example, say I am looking for a username 'mkaminski'.

Here are the entries in the database:

USERNAMES
mkaminski
kamynski
kaminsky
mikekamynski

A standard soundex search works great if the username is mkamynski, mkaminsky, etc. I would like to gather all the names that remotely sound the same. Now here is the problem...

I would also like to return the tables with usernames such as 'kaminski' when I search 'mkaminski'. The 'm' throws off the whole SOUNDEX search since that letter gives the word an entirely new sound.

It would be great if mysql supported using wildcards in the SOUNDEX function, so the 'kaminski' in 'mkaminski' could be matched as well as matching 'kaminsky' in 'mkaminski.'

This is frustrating

I'd appreciate any help, thanks.
Reply With Quote
  #2 (permalink)  
Old 10-28-05, 23:42
popskie popskie is offline
Registered User
 
Join Date: Oct 2004
Location: In cousin's house
Posts: 303
try to use dis one but im not sure.

select * from tablename where fieldname like '%kmdf%'
Reply With Quote
  #3 (permalink)  
Old 10-29-05, 09:39
Chagh Chagh is offline
Registered User
 
Join Date: May 2005
Posts: 127
hi,
you can compare the two soundex at first e.g.
Code:
select soundex('%mkaminsky%') = soundex('%kaminsky%')
and then if they were not the same use
Code:
select '%mkaminsky%' like '%kaminsky%'
may be this help!

Chagh
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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