I have a JSON data in MySQL like this
[ { "dates": [ "25.01.2021", "25.01.2021" ], "uids": { "1", "2"}, "names": [ "FileEX", "PlayerEZ" ] } ]
I want check if in uids exists eg. '1'. (If user id exists in a json table). I think i should use a JSON_CONTAINS or JSON_EXTRACT function but i don't know how i shpuld use this for this?
SELECT JSON_SEARCH(JSON_EXTRACT(@json, '$.uids'), 'one', '1') IS NOT NULL;
fiddle
1.4m articles
1.4m replys
5 comments
57.0k users