All Forums Analytics
Nolan Madson 12 posts Joined 11/08
10 Nov 2008
query that provides hierarchy

Can someone give me a pointer how to write a query that provides a sorted, indented organization hierarchy given a table with child org id and parent org id. Example of sorting below; I tried to show spaces in the indents, but this forum deletes leading spaces or tabs.Org 1Org 1's childrenOrg 1's grandchildrenetc.Org 2Org 2's childrenOrg 2's grandchildrenetc.Org 3Org 3's childrenOrg 3's grandchildrenetc.TIA,Nolan

rgs 106 posts Joined 02/07
10 Nov 2008

I think if you look at the Teradata SQL documentation under the SELECT statement using the “WITH RECURSIVE” clause they provide that exact example.

Nolan Madson 12 posts Joined 11/08
17 Nov 2008

The only example I find on p 61 lists all subordinates of a given manager at all levels by employee number, without regard to the managers in between. An employee number 100250 doesn't necessarily report to employee number 100249 and doesn't necessarily manage employee 100251.I was looking for something that would, in effect, assign sequence numbers to all employees sorting them so the lowest level subordiates would be grouped under their managers, those managers (with their subordinates below them) grouped with this peers, etc, up to the top of the hierarchy.

jayashree 1 post Joined 12/09
03 Dec 2009

We are using with recursive to display the metric hierarchy but its not showing up in correct sequence. Plz let us know if you have found any solution.

You must sign in to leave a comment.