I want to use aggregation operator to calculate certain value and then set this value to a node as property. Calculation works well and and I can return the value. When trying to set value I will get syntax error.
This query works OK:
MATCH (a:Object{category:'Personal'})-[r:BUILDS]->(b:Object{category:'Team'})
Return b.title AS team, SUM(a.achievement*r.weight/100) AS calculated
This query gives error:
MATCH (a:Object{category:'Personal'})-[r:BUILDS]->(b:Object{category:'Team'})
SET b.achievement = SUM(a.achievement*r.weight/100)
Return b.title AS team, b.achievement AS calculated
And error message is this: " Neo.ClientError.Statement.SyntaxError: Invalid use of aggregating function sum(...) in this context (line 3, column 21 (offset: 111))
"SET b.achievement = SUM(a.achievement*r.weight/100)" "
My question is how to use aggregation operator result as new property!