Employee
Hierarchy from Low Position to High Position
We have Table
for Employee And we want employee Position Hierarchy then Apply below query
WITH TempTable(ID,Name,ReportingTo)
AS
(
SELECT e.empID,e.empName,e.empReportingTo FROM
Employee_MAster e
WHERE e.empID = 'JSD001'
UNION ALL
SELECT e.empID,e.empName,e.empReportingTo FROM
Employee_MAster e, TempTable temp
WHERE e.empID = temp.ReportingTo
)
SELECT * FROM TempTable
No comments:
Post a Comment