MySQL: Check if JSON array doesn’t contain a value
14 September 2023 (Updated 14 September 2023)
Suppose you have a table like this:
![MySQL: Check if JSON array contains a value](https://sajadtorkamani.com/wp-content/uploads/2023/06/CleanShot-2023-06-27-at-14.38.28-1024x95.png)
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