Duplicate result

Hi @multshibanda,

Here is my solution (there may be others):

MATCH(a:A)-[:R1]->(b:B)
WITH DISTINCT b AS b, collect(a) AS col
RETURN DISTINCT head(col)

The WITH clause ensures that there is only one parent and collects all of its children and then returns the first child on the list for each parent:)

Regards,
Cobra

1 Like