-1

I have a mysql table tbl_users which have name field. This name field have following data.

1. Krishna
2. Tomas
3. Harry

I want to work it like this. When i search with the keyword Thomas it should match Tomas also. I tried with following query but it didn't work.

SELECT * FROM `tbl_user` WHERE name like '%Thomas%'

I am not sure it is possible in mysql or not. Please suggest me how can i do this. I am using php with mysql.

Thanks

Krishna Karki
  • 1,304
  • 4
  • 14
  • 31

1 Answers1

4

Try soundex, below is the example

select name from (
  select 'Thomas' as name
  union 
  select 'Tomas' as name
  union 
  select 'Ramprasad'  as name 
  )tmp
 where soundex(name)=soundex('Thomas')
sumit
  • 15,003
  • 12
  • 69
  • 110