I have the following setup:
A doctor can have multiple patients, and every patient can have multiple diagnosis. I need to return for Doctor X, all his associated patients and their associated diagnosis. How can I write a nested relationship query as follows? I have the following query for now:
MATCH
(p: Patient)-[:PATIENT_AT]->(d:Doctor),
(di:Diagnosis)-[:DIAGNOSIS_BY]->(d:Doctor),
(p:Patient)-[:HAS_DIAGNOSIS]->(di:Diagnosis)
WHERE
d.id=1000000
RETURN p,di
But this is returning me two separate queries. Can I get the same result in one query like:
patient 1--> all diagnosis
patient 2 --> all diagnosis
Or do I need two separate loops?