I have a table in which there is a column that stores id(s) of another table, there could be a single id or multiple ids separated by a comma (,).
I want to search multiples values against the column: "s" which again can have multiple values. So searching: "5, 3, 1" should match with the column "id" 2, 4, 5, 6 in the below table
Similarly, search "4, 5" should match with the column "id" 6, 7, 8.
So how can I get these rows distinctively?
| id | s |
+----+------+
| 1 | 2 |
| 2 | 1 |
| 3 | 2 |
| 4 | 2,3 |
| 5 | 1,3 |
| 6 | 1,2,5|
| 7 | 4,5 |
| 8 | 3,4 |
+----+------+
Please help!