select count(1) from report_configuration r where json_extract(r.report_configuration,'$.dataSetName') = :dataSetName
2.纯数组JSON查询 one代表就遇到第一个就返回 固定写法
SELECT count(1) FROM statistics_property where data_set_name = :dataSetName and JSON_SEARCH(dimensions,"one", :propertyName) IS NOT NULL
3.Json数组套对象
SELECT * FROM statistics_property where JSON_CONTAINS(statistics,JSON_OBJECT('metric','temp_back'))
4.补充1
-- 检测json 集合里是否包含IMEI 字符串
SELECT * FROM product_template where JSON_SEARCH(read_only_params_unique_keys,"one", 'IMEI') IS NOT null;
-- 检测json 集合里是否包含IMEI 字符串
SELECT *
FROM product_template
WHERE JSON_CONTAINS(read_only_params_unique_keys, JSON_QUOTE('IMEI'));
-- 检测json对象里是否包含这个键值对
SELECT * FROM product_template where JSON_CONTAINS(identification_rules,JSON_OBJECT('6','10'));
-- 检查json对象里是否包含这个Key
select * from product_template where json_extract(identification_rules,'$."6"') is not null;