Reputation: 25
What I mean is this...
Is there a way to do something like this?
SELECT * FROM table WHERE column_a LIKE %column_b%
So that the content of column_a is searched in column_b. And when there is the word 'car' in column_a, and the words 'car parts' in column_b that would be a match.
Upvotes: 2
Views: 80
Reputation: 26920
SELECT * FROM table WHERE column_a LIKE CONCAT('%', column_b , '%')
Upvotes: 3
Reputation: 7332
Use the CONCAT function like so
SELECT * FROM table WHERE column_a LIKE CONCAT('%',column_b,'%')
Upvotes: 6