Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Join Query Help

Author  Topic 

ashasivan
Starting Member

1 Post

Posted - 2007-07-25 : 05:16:41

Hi,

I have a table with following fields..

tblEmployee
-----------

EmpID int,
EmpName char(20),
MgrID int


I want the name of all employees and names of correspoding managers..

Please help me as soon as possible..

Thanks in Advance..

Regards,
Asha Sivan

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-07-25 : 07:07:27
Select a.Empid, a.Empname, Isnull(b.EmpName,'-')
From tblEmployee a left join tblEmployee b
on a.MgrID = b.EmpID

--------------------------------------------------
S.Ahamed
Go to Top of Page
   

- Advertisement -