I have a query
select X from survey
where survey_date > date_add(curdate(), interval -90 day)
which shows which X are current. But unfortunately through circumstances outside my control, the returned values are not a list of values but a list of lists of comma-separated values. So it returns
| X |
+--------------------+
|thing1 |
|thing2,thing3,thing4|
|thing5 |
|thing6,thing7 |
and so forth.
Now I wanted to use this as a subquery. If the data was one to a line, I would do
select Y from othertable
where irrelevant_conditions && Y not in (
select X from survey
where survey_date > date_add(curdate(), interval -90 day)
);
But this does not work since I might have, say thing3.
Instead I need to do RLIKE. (As it happens the data cannot collide by their form, so no extra regexp magic is needed here to check for commas.) Is that possible in MySQL?