Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    1

    Unanswered: 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.

  2. #2
    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%'

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •