且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查一个元素是否包含在MySql的json列的值(数组)中

更新时间:2023-11-29 08:46:16

这应该做到:

SELECT name, data 
FROM articolo 
WHERE JSON_CONTAINS(data, '"8"', '$.fornitori')

8 周围的双引号很重要,以便正确匹配JSON数据.另一方面,查询始终对字符串文字使用单引号.

The double quotes around 8 are important, in order to properly match the JSON data. On the other hand, the query consistently uses single quotes for string literals.