Hierarchical Query - Help Required


Hierarchical Query - Help Required


I have a table in which I have parent_value and child_value columns. Now I want to display all the values in relation to parent-child. Means emp1 is manager of emp2 and emp1 is also manager of emp3 again emp3 is manager of emp4 and emp4 is maganer of emp5. Now by providing emp1 I want see all the details like below :

Employee Manager Level
======= ======= ====
emp1 ? 1
emp2 emp1 2
emp3 emp1 2
emp4 emp3 3 --- Want to display the result till this level
emp5 emp4 4

Now can you please let me know what is the effective SQL to get the data in Teradata. In Oracle this can be achived using "start with ... connect by" query and I want to know the equivalent query for teradata or any alternative to achive the same result.


Re: Hierarchical Query - Help Required

Hi. I had similar concerns. Check the end of this thread for solution: