I currently have this JSONs in my database
user | info |
---|---|
0 | ["subscriptions": [{"user": 1}, {"user": 2}]] |
1 | [] |
2 | null |
And I want something like
SELECT *
FROM user_info
WHERE count(subscriptions) == 2
(select by count of elements in "subscriptions" key of JSON)
I've tried with JSON_SEARCH, but didn't managed to get something to work
source https://stackoverflow.com/questions/73692719/mysql-select-by-count-of-elements-in-json-array
No comments:
Post a Comment