数据库中查询json 样式的值的sql语句

方式一: 可以查到json中的Key:value

SELECT * FROM EDI.edi_history WHERE JSON_CONTAINS(response_summary, json_array(json_object("orderNo","10007"))) 
and JSON_CONTAINS(response_summary,  json_array(json_object("courierCompanyCode","Air21")))

and JSON_CONTAINS(response_summary,  json_array(json_object("dataSource", "EDI_AFTERSHIP")))

and JSON_CONTAINS(response_summary,  json_array(json_object("courierBillNo","888888")))

方式2:   仅仅通过包含:

 
select * from EDI.edi_history  where json_contains(response_summary, '{"dest_stn":"PRQ"}')

猜你喜欢

转载自www.cnblogs.com/lshan/p/9184630.html