我有一个名为settings
的表,其中program_id(number), client_id(number), filters(Jsonb)
列和filters列包含jsonb数据,格式如下-
{
"sources": [
{
"conditions": [
{
"value": [
{
"id": 1211,
"name": "ABM BETA INVITE LIST",
"isSelected": true
}
],
"condition": "one of the following"
}
],
"objectType": "SmartLists",
"subscriptionId": 1173,
"integrationType": "mkto"
}
],
"listType": "All Accounts",
"programId": 30203,
"noOfAccounts": null,
"expiryDuration": 0,
"subscriptionId": null,
"updateFrequency": null
}
我现在想从表settingswhere filters.sources[0].integrationType = 'mkto'
中检索所有记录。我已经尝试了此查询,但返回的集合函数在WHERE-中不允许
select * from settings where (jsonb_array_elements(filters -> 'sources') ->> 'integrationType' = 'mkto');
1条答案
按热度按时间zkure5ic1#
现在,我想从
filters.sources[0].integrationType = 'mkto'
所在的表设置中检索所有记录。使用
#>>
运算符:fiddle
filters #>> '{sources, 0, integrationType}'
与以下公式相同:但是您真的只想查看第一个数组元素吗?