尝试使用 S3-Select 查询 json 文件上的数据
{
"groups_id":
{
"307225":
{
"created_at": "2015-02-10T17:24:15-08:00",
"updated_at": "2017-09-06T17:25:22-07:00",
"name": "Company 1",
"company": true,
"contact_name": "User 1",
"email": "",
"phone_number": "",
"address": "",
"website": "",
"notes": "Testing",
"id": "307225"
},
"1058565":
{
"created_at": "2017-04-02T23:44:10-07:00",
"updated_at": "2017-07-18T17:39:21-07:00",
"name": "Company 3",
"company": true,
"contact_name": "User 1",
"email": "",
"phone_number": "",
"address": "",
"website": "",
"notes": null,
"id": "1058565"
}
}
}
有人可以根据 WHERE contact_name='User 1' 的条件帮助使用 s3 select 获得所需的输出。
{"id": "307225", "name": "Company 1"},
{"id": "1058565","name": "Company 3"}
以下是我们尝试过的查询,
Select s.groups_id['307225'].id from s3object s
Select s.groups_id['1058565'].id from s3object s
在上面的查询中,我们对 group_id 进行了硬编码,我们可以在下面获取
{
"id": "1058565"
}
但在我们的案例中,groupid 是动态的,所以我不理解。如何处理?