I have saved data for a column in json form:
{"sp_id": [1, 2,113],"spd_id": [],"spclg_id": []}
I would like to use WHERE IN to check if the sp_id
field contains the values specified in the array
i.e. I want to check whether there is at least one occurrence of the given values in the u_id
array.
- At least one element for
sp_id
must match - must be in mysql
- mysql version: 5.7.40
in php it would look like this:
if(count(array_intersect($needle, $haystack)))