gpt4 book ai didi

mysql - 数组中的 json_contains 返回空集

转载 作者:行者123 更新时间:2023-11-29 07:30:56 30 4
gpt4 key购买 nike

我有一个像

这样的 json 数组
{  
"response":[
{
"Rate Lock":"Yes",
"Loan Amount":"1M - 2M",
"Credit Score":"800",
"Pre-Approved":"Yes",
"Mortgage Type":"15 ARM",
"Property Type":"Commercial",
"Forecasted Close Date":"2018-07-12"
}
]
}

在名为“custom_response”的列中

select * from custom_deals_response where json_contains(`custom_response`,'"2018-07-12"')

返回和空集。我做错了什么?

最佳答案

JSON_CONTAINS 有 3 个参数(目标列、候选、路径(可选))。在您的数据结构中,您的目标搜索列位于 response 对象内。您必须将 3 个参数设置为 mySql 必须搜索的特定路径。 Documentation reference

JSON_CONTAINS(target, candidate[, path])

 select * from custom_deals_response 
where json_contains(`custom_response`,'{"Forecasted Close Date":"2018-07-12"}','$.response');

关于mysql - 数组中的 json_contains 返回空集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51331449/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com