Link Search Menu Expand Document

ARRAY_SUM_GLOBAL

Returns the sum of elements in the array column accumulated over the rows in each group.

For more information and the sample data used in the example below, please refer to Aggregate Array Functions.

Syntax

The example below uses the following table T:

Category vals
a [1,3,4]
b [3,5,6,7]
a [30,50,60]
ARRAY_SUM_GLOBAL(<arr>)
Parameter Description
<arr> The array column over which the function will sum the elements

Example

SELECT
	Category,
	ARRAY_SUM_GLOBAL(vals) AS sm
FROM
	T
GROUP BY
	Category;

Returns:

category sm
a 8
b 21
c 140