I have a variable which contains comma separated value '1,2,3'
and my table is as below
id favourite_id
1 2,5,6
2 3,5,7
3 6,1,3
4 5,6,7
I want to check my variable against favourite_id column to find at least one value is common in favourite_id. so I want output of mysql query as below
id favourite_id
1 2,5,6
2 3,5,7
3 6,1,3
I know that this is not normalized table structure but I am not able to change my database structure.I have googled a lot but could not found suitable solution.
5, something like that?idof 1, 2 and 3 as these rows also have a 1, 2 or 3 in thefavourite_idcol.