apoc.coll.sum
Syntax |
|
||
Description |
Returns the sum of all the |
||
Arguments |
Name |
Type |
Description |
|
|
The list of numbers to create a sum from. |
|
Returns |
|
Usage examples
The following examples compute the sum of values in a list using both APOC and Cypher:
apoc.coll.sum
WITH [1,2,3,4,5] AS list
RETURN apoc.coll.sum(list) AS output
Using Cypher’s reduce()
WITH [1,2,3,4,5] AS list
RETURN reduce(sum = 0.0, x IN list | sum + x) AS output
Output |
---|
15.0 |