I am using neo4j MATCH
and get two list of User: listA,listB,
and listB is part of listA
how can I return users only in listA but not in listB use cipher query
the cipher like :
MATCH listA, listB
RETURN listA - listB
Here is my previous question: neo4j cypher multi relationship between nodes
Done See solution in the link above
To return members of one list that are not in another you can use the FILTER
function (docs), for example
WITH [1,2,3,4,5,6] as listA, [1,2,3] as listB
RETURN FILTER( n IN listA WHERE NOT n IN listB ) as listC
c
4, 5, 6
Returned 1 row in 90 ms
Filter function is removed in the latest Neo4j version 4.0 doc here instead, use List comprehension
WITH [1,2,3,4,5,6] as listA, [1,2,3] as listB
RETURN [n IN listA WHERE NOT n IN listB] as listC
This results in an output 4, 5, 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With