SUM_EACH
Stores the sum of values per group.
Syntax
SUM_EACH([MAX VALUES, ]GROUP, VALUE)
Arguments
MAX VALUES:
The maximum number of entries that can be counted (default: 2,147,483,647).
Beyond that, entries will be discarded. In some cases, depending on the data
distribution, discarding groups via MAX VALUES
may cause some data to be
discarded from groups that would otherwise have been returned.
MAX VALUES
is optional. If it is omitted there is, in effect, no limit.
GROUP:
The field you would like counted.
VALUE:
The field that is summed.
Returns
A number
Notes
SUM_EACH
can be used only with hierarchical output types.
SUM_EACH
returns a mapping of the key value where the key is the GROUP
, and the value is the summation of the VALUE
field over all the entries that have the same GROUP
key. In the example below, all the "scores" for each "user" key are summed.
Example
Data
Query
Find the total score for each user:
Results
Related Functions
Dialog
Last updated