【发布时间】:2020-01-01 18:21:01
【问题描述】:
我正在尝试从 Postgres 中的以下 JSONB 数组中获得机会等于转售。但我似乎无法弄清楚。
{
"done": true,
"size": 106,
"records": [{
"Name": "FEF",
"IsActive": true,
"attributes": {
"price": "3",
"width": "20"
},
"Description": null,
"Opportunity": "Resale"
}, {
"Name": "DHQ",
"IsActive": true,
"attributes": {
"price": "300",
"width": "10000"
},
"Description": null,
"Opportunity": "Resale"
}]
}
SELECT salesdata
FROM public.salesdata
where salesdata -> 0 ->> '"records":[{"Opportunity":"Resale"}]';
错误:
SQL 错误 [42804]:错误:WHERE 的参数必须是布尔类型,而不是文本类型
【问题讨论】:
-
我使用的是 12 版的 postgre
-
你期望的输出是什么?
标签: postgresql jsonb