首页 > 解决方案 > 如何搜索JSON数组包含mysql中的项目

问题描述

我的数据库中有类型图像(json)。它的字符串数组。

如何选择images包含的所有行"foo"

在此处输入图像描述

标签: mysqlsqlarraysjsonwhere-clause

解决方案


使用json_contains()

select t.*
from mytable t
where json_contains(images, '"foo"')

推荐阅读