【巨杉数据库Sequoiadb】SequoiaDB是否支持在group by时sum函数的参数
【问题详细描述】
在SequoiaDB中,在group by 时,decimal(高精度数)类型的字段可以做sum函数吗?
【解决办法】
1.decimal类型是支持在group by 时做聚集函数的,例如:
集合cl中现有如下数据:
{"a":{"$decimal":"111.111"},"name":"zhangsan"}
{"a":{"$decimal":"222.222"},"name":"zhangsan"}
{"a":{"$decimal":"123.456"},"name":"lisi"}
2.在使用group by 时对decimal类型的 'a' 字段做聚集函数
db.exec("select sum(a) as 总和 from cs.cl group by name")
3.结果如下:
{"总和":{"$decimal":"123.456"}}
{"总和":{"$decimal":"333.333"}}
【详情参考】
高精度数:http://doc.sequoiadb.com/cn/SequoiaDB-cat_id-1519612297-edition_id-300
聚集函数:http://doc.sequoiadb.com/cn/index-cat_id-1432190972-edition_id-300
【解决办法】
decimal类型是支持在group by 时做聚集函数的,例如:
1.集合cl中现有如下数据:
{"a":{"$decimal":"111.111"},"name":"zhangsan"}
{"a":{"$decimal":"222.222"},"name":"zhangsan"}
{"a":{"$decimal":"123.456"},"name":"lisi"}
2.在使用group by 时对decimal类型的 'a' 字段做聚集函数
db.exec("select sum(a) as 总和 from cs.cl group by name")
3.结果如下:
{"总和":{"$decimal":"123.456"}}
{"总和":{"$decimal":"333.333"}}
【详情参考】
高精度数:http://doc.sequoiadb.com/cn/SequoiaDB-cat_id-1519612297-edition_id-300
聚集函数:http://doc.sequoiadb.com/cn/index-cat_id-1432190972-edition_id-300
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。