0

I would like to search for people in my MySql database. The way I would like to do it is to check if there is a partial match of an x% with a list of names. I want to do this partial match in order to avoid to miss people due to spelling mistakes.

However, the only way I am able to do a partial match is through the "Like" operator. Is there a way to do something like this in MySql?

SELECT CONCAT(name, ' ', surname) as fullname 
FROM users 
WHERE MATCH fullname IN ('%joe green%' or '%marc blue%') >80%
nemja
  • 459
  • 4
  • 19
  • 2
    Define `partial match of 70% or higher`.. Post example data (place it on sqlfiddle.com or db-fiddle.com).. Also post expected result as a text formatted data table. – Raymond Nijland Aug 01 '18 at 09:50
  • 1
    https://stackoverflow.com/questions/35212058/mysql-search-for-right-words-fixing-spelling-errors ... Or http://sjhannah.com/blog/2014/11/03/using-soundex-and-mysql-full-text-search-for-fuzzy-matching/ – Raymond Nijland Aug 01 '18 at 10:00
  • MATCH (head, head, body) AGAINST ('some words' IN BOOLEAN MODE) – kiran malvi Aug 01 '18 at 10:12
  • 1
    @kiranmalvi So: SELECT CONCAT(name, ' ', surname) as fullname FROM users WHERE MATCH (fullname) AGAINST ('joe green, henk blue' IN BOOLEAN MODE) – nemja Aug 01 '18 at 10:34

0 Answers0