I need to retrospectively set a relationship property to the MAX of a value from the 2 nodes connected by it.
This sudo code is what im trying to do..
MATCH (a)-[r:Follows]->(b) SET r.prop = MAX(a.prop, b.prop)
But MAX doesn't work like that, its for finding the max from a collection.
Any ideas how to do this?
This is probably easiest with CASE
.
MATCH (a)-[r:Follows]->(b)
SET r.prop = CASE WHEN a.prop > b.prop THEN a.prop ELSE b.prop END;