0
希望當我運行下面的查詢,總結與JSON內部元件使用N1QLCouchbase
SELECT * FROM myBucket WHERE ANY x IN transactions SATISFIES x.type in [0,4] END;
結果:
{
"_type": "Company",
"created": "2015-12-01T18:30:00.000Z",
"transactions": [
{
"amount": "96.5",
"date": "2016-01-03T18:30:00.000Z",
"type": 0
},
{
"amount": "483.7",
"date": "2016-01-10T18:30:00.000Z",
"type": 0
}
]
}
我得到多個JSON這樣
SELECT sum(transactions[*].amount) FROM Inheritx WHERE ANY x IN transactions SATISFIES x.type in [0,4] END;
結果: [ { 「$ 1」:null } ]
現在我想總結這一切。我該怎麼做?