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"')