I am trying to use the SUM
function and store the result of it as a new property of the relationship. But it is not working.
The query I used is :
MATCH (a:Employee)-[r:CorporateMessage]->(b)
WHERE a.Eid = 6001 AND b.Eid IN [6002,6003,6004,6005,5001]
SET r.Internalsum = SUM(r.Count)
The error i got was:
Invalid use of aggregating function sum(...) in this context (line 1, column 124 (offset: 123)) "MATCH (a:Employee)-[r:CorporateMessage]->(b)WHERE a.Eid = 6001 AND b.Eid IN [6002,6003,6004,6005,5001] SET r.Internalsum = SUM(r.Count)"
Kindly explain what i am doing wrong.
Try it:
Always put aggregation functions in
WITH
orRETURN
.