SQL Server - Select EmployeeName and ManagerName from the table

Asked By Aman Kedia on 06-Sep-16 12:56 PM
Table Employee

EmpId Name Salary ManagerId
1 Aman 1200 2
2 John 2500 3
3 Stev 1800 4
4 Kriti 2000 5
5 Tina 2500 1

print the employeeName along with their Managername

Note : ManagerId is from the same table column EmpId

Please help me.
bhanupratap singh replied to Aman Kedia on 13-Sep-16 03:31 PM
Hi
Write like this.

Select
 e.EmpId,
e.EmpName,
e.EmpSalary,
d.Designation

from tblEmployeeTable e
inner join  tbDesignation d
on e.empId=d.empId
where e.empid=@empid
 it will give you employee details with manager name.
For manager name you will have to use tbldesignation