Hi,
Actually this is my table data:
EmployeeId EmpName ReportTo
---------- ------------------------- ----------
CEO CEO -
FM FM CEO
HR HR CEO
Oth Oth CEO
PM1 PM1 PMH
PM2 PM2 PMH
PM3 PM3 PMH
PMH PMH CEO
TL11 TL11 PM1
TL12 TL12 PM1
TL21 TL21 PM2
TL22 TL22 PM2
TL23 TL23 PM2
TL31 TL31 PM3
TL32 TL32 PM3
TL33 TL33 PM3
TL34 TL34 PM3
I want to write a recursive Stored Procedure that gets subordinates of a particular given person.
For Eg.
if i give as PMH as input parameter for stored procedure, it should return the following output:
EmployeeId EmpName ReportTo
---------- ------------------------- ----------
PM1 PM1 PMH
PM2 PM2 PMH
PM3 PM3 PMH
TL11 TL11 PM1
TL12 TL12 PM1
TL21 TL21 PM2
TL22 TL22 PM2
TL23 TL23 PM2
TL31 TL31 PM3
TL32 TL32 PM3
TL33 TL33 PM3
TL34 TL34 PM3
Can any body help me in this issue?
Expecting for the reply.
Ramkumar
A.D.Ramkumar
|