I have a table and I want to get the row with the value that most closely resembles the searched text. For example if searched text is 'rakul' it should be able to select row with value 'rahul'
Asked
Active
Viewed 462 times
0
-
MySQL doesn't have a rich full text capabiliity. Try a dedicated [full text search engine](https://stackoverflow.com/questions/737275/comparison-of-full-text-search-engine-lucene-sphinx-postgresql-mysql) – danblack Feb 27 '19 at 12:58
-
3Not an answer, but is your logic here "sounds like" or "looks like," or maybe both? – Tim Biegeleisen Feb 27 '19 at 12:59
-
well looks like. if it was sounds like i could have used soundex function in mysql – sahil sanwal Feb 28 '19 at 10:32
1 Answers
0
Just change the Customers value to your table name and the FirstName to what column you want to search and the David to your word want to search for it
SELECT * FROM Customers WHERE FirstName LIKE '%David%';

yali
- 1,038
- 4
- 15
- 31
-
well the other word is a variable (which is the word that search is for). so query would become something like SELECT * FROM Customers WHERE FirstName like '%
%'; so even if i search for dabid it will not retrun the correct result(which is david) – sahil sanwal Feb 28 '19 at 10:30 -
yeah please read this examples , you will clearly understand how to use like for serach https://www.w3schools.com/sql/sql_like.asp – yali Feb 28 '19 at 11:36