MySQL - In this situation, path expressions may not contain the * and ** tokens.

阅读 40

2022-05-18



MySQL 8.0 支持 JSON 字段 CRUD 时,对 JSONPath 写法通配符解决方案~



错误写法

SELECT service_id 
FROM t_sc_service
WHERE JSON_CONTAINS(service_graph, '"09ba822e980a011579ed8252873177f5"', '$.apiList.*.apiId')
  • 报错:[Err] 3149 - In this situation, path expressions may not contain the * and ** tokens.


正确写法

SELECT * 
FROM t_sc_service
WHERE JSON_CONTAINS(service_graph->'$.apiList.*.apiId', '"846226a5e487edd9294fedd86bc99702"')


精彩评论(0)

0 0 举报