|
Archives of the TeradataForumMessage Posted: Fri, 19 Nov 2004 @ 10:52:21 GMT
Hi All, Can we write recursive queries in Teradata. I have a requirement wherein I need to display Hierarchy tree for a supervisor. The table would have 2 fields empid and supervisor Id:- Sample Data Employee-Id Supervisor-id 1 --- 2 1 3 2 4 2 5 4 6 4 I want it to be implemented in a single query .. Below is a pseudocode for recursive solution to same:- DisplayTree(Supervisor_id) ( If emp_id not in ( supervisor's list) display empid exit Else Display empid CALL displayTree(emp_id) End if ) Thanks and Regards, Rachana
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||