Get the App
SLTechnology News&Howtos  ›  Database  › 

[giant sequoia database Sequoiadb] whether SequoiaDB supports the parameters of the sum function in group by.

Shulou Source: shulou.com Published: 2022-06-01 05:08:43 09月29日 Update

[detailed description of the problem]

In SequoiaDB, when group by, can fields of decimal (High Precision number) type do sum functions?

[solution]

The 1.decimal type supports aggregate functions in group by, such as:

The following data is available in the collection cl:

{"a": {"$decimal": "111.111"}, "name": "zhangsan"}

{"a": {"$decimal": "222.222"}, "name": "zhangsan"}

{"a": {"$decimal": "123.456"}, "name": "lisi"}

two。 Aggregate the'a 'field of type decimal when using group by

Db.exec ("select sum (a) as sum from cs.cl group by name")

3. The results are as follows:

{"decimal": {"$sum": "123.456"}}

{"decimal": {"$sum": "333.333"}}

[reference for details]

High precision number: http://doc.sequoiadb.com/cn/SequoiaDB-cat_id-1519612297-edition_id-300

Aggregate function: http://doc.sequoiadb.com/cn/index-cat_id-1432190972-edition_id-300

[solution]

The decimal type supports aggregate functions in group by, such as:

1. The following data is available in the collection cl:

{"a": {"$decimal": "111.111"}, "name": "zhangsan"}

{"a": {"$decimal": "222.222"}, "name": "zhangsan"}

{"a": {"$decimal": "123.456"}, "name": "lisi"}

two。 Aggregate the'a 'field of type decimal when using group by

Db.exec ("select sum (a) as sum from cs.cl group by name")

3. The results are as follows:

{"decimal": {"$sum": "123.456"}}

{"decimal": {"$sum": "333.333"}}

[reference for details]

High precision number: http://doc.sequoiadb.com/cn/SequoiaDB-cat_id-1519612297-edition_id-300

Aggregate function: http://doc.sequoiadb.com/cn/index-cat_id-1432190972-edition_id-300

Tags: Function summation type field degree high precision data support result reference method problem parameter database Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info OPPO Reno Shulou Information Xiaomi