MySQL question about "reverse LIKE"

Ok, I have a value that I want to check for potential matches in the database (in a single varchar field), so I am writing something like:

SELECT * FROM table WHERE column LIKE "%value%"

Which will work if the value is something like "test", and the column has the value "this is test", however, if it is canceled, then I will not get a match. I tried things line by line:

SELECT * FROM table WHERE CONCAT("%",column,"%") LIKE "value"

but I don’t know exactly how to express it on Google, to get the answer I need, please help!

+5
source share
2 answers

You can cancel like. Just using the same syntax as a regular likequery:

select
    *
from
    table
where
    'value' like concat('%', column, '%')

, , instr:

select * from table where instr('value', column) > 0

, , MySQL , , .

+11
SELECT *
FROM table
WHERE 'value' LIKE CONCAT('%', column, '%')
+3

All Articles