You can have another WITH
and UNWIND
.
Match (m:class)-[r]-(n:student) where n.name in ['aa','bb','cc']
WITH COLLECT(m) AS EXCLUDED
MATCH (m1:class)-[r1]-(n1:student) where n1.name in ['dd','ee']
WITH EXCLUDED, COLLECT(m1) AS included
WITH FILTER(m1 IN included WHERE NOT m1 IN EXCLUDED) as _results
UNWIND _results as results
RETURN results.name
Note: FILTER()
is deprecated in neo4j 3.5 and removed in 4.0 in favor of List Comprehension
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…