简体   繁体   中英

Sum two properties of the same node in Cypher

I can sum a property of all the node given from a cypher query. But ¿is it posible to sum two properties of the same node?

Example: MATCH (n: Node ) WITH na + nb as sum RETURN sum

UPDATE: Resolve in other comments, but if you want to get a sum of multiple properties of all nodes you can do:

MATCH (n:Node)
WITH sum(n.a + n.b) AS sum
RETURN sum

Yes, you can. In your example you could just do

MATCH (n:Node) RETURN n.a + n.b AS sum

http://console.neo4j.org/r/dqq2cx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM