如何在 Cypher 中对两个数字求和?
How to sum two numbers in Cypher?
给定两个数字属性 n.in
和 n.out
,我怎样才能得到它们的总和?
我的查询
match (n)
return n.name, id(n), sum(n.in,n.out);
但显然这是错误的,因为 SUM
is for only one property. Looking at Numeric mathematical functions 也没有这样的功能。
像这样?
match(n)
with sum(n.in + n.out) as sumOfAllNodes
match(n)
return n.name, id(n), n.in + n.out as sumOfaNode, sumOfAllNodes
给定两个数字属性 n.in
和 n.out
,我怎样才能得到它们的总和?
我的查询
match (n)
return n.name, id(n), sum(n.in,n.out);
但显然这是错误的,因为 SUM
is for only one property. Looking at Numeric mathematical functions 也没有这样的功能。
像这样?
match(n)
with sum(n.in + n.out) as sumOfAllNodes
match(n)
return n.name, id(n), n.in + n.out as sumOfaNode, sumOfAllNodes