I have a model with students and the courses that they assisted. All students have a groupNumber.
So when I want to get all the students that assisted to same course but are from a different groupNumber I do this:
MATCH (s1:Student)-[:Assisted]-(c:Course), (s2:Student)-[:Assisted]-(c)
WHERE s1.groupNumber <> s2.groupNumber
RETURN s1, s2
This works, however, this shows me something like this:
Paul | Steve
Steve | Paul
Carl |Steve
Steve | Mark
Is there a simple way to avoid showing repeated students?