Reputation: 3215
I have a node that has properties based on another node, For example:
MATCH (n:draft {sn:1}),(m:final {sn:1})
SET m.count = m.count - n.count
RETURN m
Seems to work. However what I want to do is set m.count
to 0 if n.count > m.count
. n.count > m.count
results in a negative value and I want to avoid this.
Upvotes: 0
Views: 314
Reputation: 5482
You should be able to do this:
MATCH (n:draft {sn:1}),(m:final {sn:1})
SET m.count = CASE WHEN n.count > m.count THEN 0 ELSE m.count - n.count END
RETURN m
Upvotes: 1