How to query soundex() in mysql

jimmytiler picture jimmytiler · Apr 13, 2015 · Viewed 10.7k times · Source

What is the proper structure for searching within MySql using soundex()? I know how to produce a soundex():

select soundex('str');

just not sure how to include this in my query.

Answer

pala_ picture pala_ · Apr 13, 2015

If you're searching for "lewis" against the name field of people table, you perform this query:

SELECT *
FROM people
WHERE soundex("lewis") = soundex(name);

example here