Firebase数据库Groupby使用

时间:2016-12-02 12:36:58

标签: firebase firebase-realtime-database nosql

例如:我的firebase数据库必须遵循以下数据。

datas=[{ "category" : "Content Server", "hits" : 1, "bytes" : 17308 },
{ "category" : "Content Server", "hits" : 1, "bytes" : 47412 }, 
{ "category" : "Search Engines", "hits" : 1, "bytes" : 7601 }, 
{ "category" : "Content Server", "hits" : 1, "bytes" : 24210 }, 
{ "category" : "Internet Services", "hits" : 1, "bytes" : 3690 }, 
{ "category" : "Search Engines", "hits" : 6, "bytes" : 613036 }, 
{ "category" : "Search Engines", "hits" : 1, "bytes" : 2858 } ];

如何使Firebase数据库与此SQL查询等效:

SELECT category, sum(hits), sum(bytes) 
FROM datas 
GROUP BY category 
ORDER BY sum(bytes) DESC

0 个答案:

没有答案