Start with-connect by SQL for lowest level in hierarchy or tree structure
Hi,
In a tree structure as given below how can i get all the lowest level (of tree) child records like - E, H, G and D.
A has B, C, D at level 2
B has E and F at level 3, and C has G at level 3
F has H at level 4
A
|l |l |l
B C D
|l |l |l
E F G
|l
H
I was able to use start with and coonect by to give all the levels of the tree as follows -
SELECT task_id,parent_task_id, top_task_id,level
FROM pa_tasks
WHERE project_id = :p
START WITH parent_task_id IS NULL
CONNECT BY PRIOR task_id = parent_task_id
Thanks
Edited by: user10648285 on Oct 17, 2011 11:42 PM
Edited by: user10648285 on Oct 17, 2011 11:42 PM
Edited by: user10648285 on Oct 17, 2011 11:42 PM
Edited by: user10648285 on Oct 17, 2011 11:43 PM