|| apoc.coll.runningTotal - APOC 核心文档 - Neo4j 文档

apoc.coll.runningTotal

详情

语法

apoc.coll.runningTotal(list)

描述

返回累积的 `LIST`。

参数

名称

类型

描述

list

LIST

要返回运行总计的列表。

返回

LIST

使用示例

以下示例使用 APOC 和 Cypher 返回包含所有先前值的运行总计的列表

apoc.coll.runningTotal
WITH [1,3,5,7,9] AS list
RETURN apoc.coll.runningTotal(list) AS output
使用 Cypher 的 reduce()
WITH [1,3,5,7,9] AS list
RETURN reduce(cumL = [head(list)], x IN tail(list) | cumL + (last(cumL) + x)) AS output
结果
输出

[1, 4, 9, 16, 25]

© . This site is unofficial and not affiliated with Neo4j, Inc.