Reputation: 472
How can I use soundex
function on the following WHERE
clause?
WHERE usr.name LIKE CONCAT('%', :search, '%')
Given that the general approach for using SOUNDEX
function is:
SELECT name FROM users WHERE soundex('Dennis') = soundex(name)
However, I am getting confused on how to code it on the above where
clause as I have used LIKE. I am using MySQL and PDO.
Upvotes: 0
Views: 916
Reputation: 472
I got the answer. Posting for someone searching in future.
WHERE (soundex(:search) = soundex(usr.name)) OR (usr.name LIKE CONCAT('%', :search, '%'))
Upvotes: 1