Using LIKE is very common in MySQL. We use it like this: WHERE field LIKE '%substring%'
. Where we have a substring and field has full string. But what I need is something opposite. I have substrings in field. So, I want that row which contains a substring of my string. Suppose the table is:
----+-------------------
id | keyword
----+-------------------
1 | admission
----+-------------------
2 | head of the dept
----+-------------------
and I have a string from user: Tell me about admission info
. I need such a MySQL query that returns admission
as this is a substring of user string. Something like:
SELECT keyword FROM table WHERE (keyword is a substring of 'Tell me about admission info')
thanks in advance.