Many database queries rely on seeing if two columns match / differ, however sometimes you may want to check if either column contains a sub-string of the other. MySql allows you to do this, but it isn’t that well documented, so hopefully this will help someone looking for this in the future
SELECT *
FROM
`table`
WHERE
`col1` LIKE CONCAT('%', `col2`, '%')
OR col2 LIKE CONCAT('%',`col1`,'%')

I just had to write this to thank you!
This is EXACTLY what I needed. I have been combing Google for an answer for hours now. Yours is exactly what I was looking for.
Does it work if columns belong to 2 different tables.If so can you please give an example for same?
Thanks