美文网首页
MySQL JSON 数组条件搜索

MySQL JSON 数组条件搜索

作者: 承诺一时的华丽 | 来源:发表于2022-05-04 20:57 被阅读0次
JSON数据字段:

{"DY_houseCheck":[1],"DY_carCheck":[1],"DY_carTypeCheck":[1],"DY_house":["有"],"DY_car":["无"],"DY_carType":["按揭"]}

查询字段JSON中的属性
select describe_where,JSON_QUERY(describe_where, '$.DY_houseCheck') from product
  • 查询结果


    结果
  • 条件查询 - 数组包含的值

select JSON_QUERY(describe_where, '$.DY_houseCheck') from product WHERE JSON_CONTAINS(JSON_QUERY(describe_where, '$.DY_houseCheck'),'1')

describe_where字符串数组包含查询
select  * from expert where   json_contains(describe_where,CONCAT('"',"22",'"'))

相关文章

网友评论

      本文标题:MySQL JSON 数组条件搜索

      本文链接:https://www.haomeiwen.com/subject/qhegyrtx.html