Supposedly there's a set of records where each record looks like the following:
{
"total": 300,
"items": [
{
"id": "item1",
"amount": 100
},
{
"id": "item2",
"amount": 200
},
]
}
Is it possible to do a sum of all totals and items with id = "item1"?
So basically, smth like this (i know that query is ultimately incorrect, but just to show the idea):
select sum(total) as total, sum(items(id="item1").amount) as item1Amount
from MyRecord
Got the answer from GitHub's project. Apparently my initial hypothetical query was quite close to what it should be.
Here's the answer: