Click to See Complete Forum and Search --> : Find the EmployeeName and ManagerName


muralirajan
August 11th, 1999, 07:28 AM
How to list the Employee Name & respective Manager Name from the following table? Since Manager is also an Employee it is given in the same table

EmpId MgrId EmpName
001 100 Murali
002 200 Raja
100 1000 Vasanth
200 2000 Bharath

I want the SQL statement which gives the following result

EmpName MgrName
Murali Vasanth
Raja Bharath


muralirajan

Lothar Haensler
August 11th, 1999, 07:36 AM
try this:
select e.empid, e.empname, e2.empname 'Manager' from empl e
inner join empl e2 on e.mgrid=e2.empid