What method should I use in MySQL to match two or more strings with a column?
I have a column string
which contains keywords such as apple
, orange
, and lemon
. What I need to have is to search rows that contains apple
and orange
using regex, the command has something like this:
where string regexp '(apple|orange)' and fruit = 1
The command above will break the rule, if a row with fruit 1
has only apple
it should be not included in the result because fruit 1
didn't have another row which contains orange
.