I have two NodeType: Parent and Child and a relation : HAS_CHILD
Each Child has a name.
Each parent has many children.
I need to retrieve all children of a parent if this parent has a child matching a certain name.
So far I only succeed to retrieve the Parents and the children matching the name, but I need all the children of these parents.
MATCH (p:Parent)-[HAS_CHILD]->(c:Child) WHERE toLower(c.name) = 'Alex'
RETURN p, c
>Solution :
Now that you have all the parents that have a child with the name ‘Alex` (these are nodes p), you can use them to get their children:
MATCH (p:Parent)-[:HAS_CHILD]->(c:Child)
WHERE toLower(c.name) = 'alex'
WITH p
MATCH (p)-[:HAS_CHILD]->(c:Child)
RETURN p, c