I have an object A and another object 'junctionA' having two lookups to object 'A' like, parentRec(lookup)->A and childRec(lookup)->A.Now hereA1->A2->A3->A4..A2 is the child of A1 and A3 is the child of A2 n soo on..How can I write a dynamic query on A get the related childs of it.The hierarchy here is dynamic A1-> can have A2 as child and A2 having child -A3but another record may have only up to only level like A-A1 can somebody pls help in writing the dynamic query on A and the junction object in nested query..Thanks in Advance