I have two node types: Actor and Movie.
I want to group actors by movies they performed in.
That's why I've created Cypher query:
MATCH (a1:Actor)-[:performed_in]->(m:Movie)<-[:performed_in]-(a2:Actor)
RETURN a1.name, a2.name,
COLLECT(DISTINCT m.name)
Unfortunately, the result is not as I need.
The problem is that I've got a table like this:
a1 a2 m
Sam Joe Movie1, Movie2
Joe Sam Movie1, Movie2
As you can see I have two rows which mean the same in that situation.
How can I get rid of that?