- table name table1,
- primary column column 1,
- column name column2,
- data in column2 '1,2,3' where column1=1.
Query:
select `id`
from `table2`
where `id` IN (select `column2` from `table1` where `column1`=1)
I found the following way to solve this till now,
- I can run the subquery separately.
- Use the
find_in_set()
function.
As find_in_set
is non-sargable I was looking for a solution where I can do this within one query.