+ Start a Discussion

Nested Map

I have an object A and another object 'junctionA' having two lookups to object 'A'  like, parentRec(lookup)->A and childRec(lookup)->A.
Now here
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  -A3
but 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
Point missed: A can have A1,A2 as childs and A2 can inturn have A3 and A4