Link Search Menu Expand Document


Returns the sum of elements of <arr>. If the argument <func> is provided, the values of the array elements are converted by this function before summing.


ARRAY_SUM([<func>,] <arr>)
Parameter Description
<func> A Lambda function with an arithmetic function used to modify the array elements.
<arr> The array to be used to calculate the function.


This example below uses a function to first add 1 to all elements before calculating the sum:

	ARRAY_SUM(x -> x + 1, [ 4, 1, 3, 2 ]) AS res;

Returns: 14

In this example below, no function to change the array elements is given.

	ARRAY_SUM([ 4, 1, 3, 2 ]) AS res;

Returns: 10