apoc.agg.product
Syntax |
|
||
Description |
Returns the product of all non-null |
||
Arguments |
Name |
Type |
Description |
|
|
A value to be multiplied in the aggregate. |
|
Returns |
|
Usage examples
The following examples computes the product of numeric values in a list using both APOC and Cypher:
apoc.agg.product
UNWIND range(1,10) AS values
RETURN apoc.agg.product(values) AS result,
1*2*3*4*5*6*7*8*9*10 AS manualEquivalent
Using Cypher’s reduce()
WITH range(1,10) AS values
RETURN reduce(x = 1, i IN values | x * i) AS result,
1*2*3*4*5*6*7*8*9*10 AS manualEquivalent
result | manualEquivalent |
---|---|
3628800 |
3628800 |