I have the following query :
SELECT * FROM `user`
WHERE MATCH (user_login) AGAINST (\'supriya*\' IN BOOLEAN MODE)
Which outputs all the record
Match doesn't work with starting wildcards, so matching with *abc*
won't work. You will have to use LIKE
to achieve this:
SELECT * FROM user WHERE user_login LIKE '%abc';
This will be very slow however.
If you really need to match for the ending of the string, and you have to do this often while the performance is killing you, a solution would be to create a separate column in which you reverse the strings, so you got:
user_login user_login_rev
xyzabc cbazyx
Then, instead of looking for '%abc'
, you can look for 'cba%'
which is much faster if the column is indexed. And you can again use MATCH if you like to search for 'cba*'
. You will just have to reverse the search string as well.