0

How soundex function can be used if I have following problem :

name         | Soundex_value 
Kap Pup Nup  | K151 ( came from soundex('Kup Pup Nup')
Kap          | K100

Now if I want to get all the rows where name field contains any soundex value of 'Kap'.

If I type 'Cap' then it should give me both rows and If I type 'Kup' then also.

Anyone can suggest me a solution ?

So far, I come up with this solution :

select * from table where soundex(`name`) like concat(soundex('kap'),'%');

But this query is working fine if there is only one word in 'name' field.

Satish Saini
  • 2,880
  • 3
  • 24
  • 38
  • SOUNDEX works on the whole value - so you won't get `K100` if `Kap`is somewhere later on in your value and not at the beginning. If you want to have single SOUNDEX results for individual words, then you have to split up those words before. – CBroe Jun 27 '13 at 10:46
  • Also, soundex is designed to work well with English names, and is not designed to cope with non English names (or other words). Try metaphone instead. – Kickstart Jun 27 '13 at 10:53

0 Answers0