Have the below relationship
Bob-[:TWINS]-Alice
I need to return all twins. Below is the cypher being used but returns duplicates
MATCH a-[:TWINS]-b
RETURN a.name, b.name
I've set this up in Neo4j console here.
How not to return duplicates? I know this can be easily fixed by including the direction of the relationship but here the direction is not relevant. So wondering how to avoid duplicates.
This is the classic way:
MATCH a-[:TWINS]-b
WHERE id(a) < id(b)
RETURN a, b
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