MySQL: Check if JSON array doesn’t contain a value
14 September 2023 (Updated 14 September 2023)
Suppose you have a table like this:
And you want to find all the records where user_types
doesn’t contain the entry "CLIENT"
. You can do this with the below query:
SELECT *
FROM user
WHERE NOT JSON_CONTAINS(user_types, '"CLIENT"')
Tagged:
MySQL
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment