select * from 表名 where json字段名 ->> '$.json下的key值'

如果遇到json 嵌套的情况

select * from 表名 where json字段名 ->> '$.json下的key值.key值'以此类推。

(仅仅支持mysql5.7版本及以上)

 

id message_content 
1 {"reason": "未匹配任何规则", "applyId": "677ccd673a774283b10481c5c3104946", "auditConsequence": "0"}
2 {"reason": "未匹配任何规则", "applyId": "677ccd673a774283b10481c5c3104945", "auditConsequence": "0"}
3 {"reason": "未匹配任何规则", "applyId": "e39b453b9ae04e4980caba9099fbc551", "auditConsequence": "1"}

SELECT
message_content ->> '$.reason'
FROM
表名
WHERE
message_content ->> '$.auditConsequence' = '-1'

相关文章:

  • 2021-12-17
  • 2022-01-31
  • 2021-08-05
  • 2021-05-17
  • 2021-10-07
  • 2021-08-09
  • 2021-07-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案