Hi All,
I've a table whose schema and sample data are as follows:
EmpCode ManagerCode
========= =============
1 1
2 1
3 2
4 2
5 3
6 2
7 3
8 4
The name of the table is EMP
Now my task is to create a query which will give a hierarchy of manager against a particular EmpCode. Say for example for EmpCode 7 the output will be
EmpCode
=======
1
2
3
I've tried with self join but its giving only the immediate manager not the total hierarchy. It will be of great help if provided with any clue to achieve this result