Hi,
I am writing an sql to get manager hierarchy all in one row.
Sample Data:
EMPID EMPNAME MGRID MGRNAME
20125 AX123 20130 ZX987
20130 ZX987 20198 BY234
20198 BY234 20156 YU875
20156 YU875 20001 CEO
20001 CEO NA NA
I am looking for, if I take an employee, I want to look at Employee Mgr Hirerarchy in same row, like:
If I take 20125 EMPID,
EMPID EMPNAME EC1 EC1NAME EC0 EC0NAME
20198 BY234 20156 YU875 20001 CEO
If I take 20125 EMPID,
EMPID EMPNAME EC3 EC3NAME EC2 EC2NAME EC1 EC1NAME EC0 EC0NAME
20125 AX123 20130 ZX987 20198 BY234 20156 YU875 20001 CEO
Please advise how I can acheive the above scenario.
Thanks
AMan