Hi Friend,
I have a problem in database. There are a table with colums Emp_ID, Emp_name and Manager_ID and i fetch the data Emp_Name who is the is the Manager correspond to Manager_ID.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted May 27, 2012, 5:41 AM
Table employee
Create table employee (Emp_ID varchar(255),Emp_name varchar(255),Manager_ID varchar(255))
Table Data
Emp_ID Emp_name Manager_ID
1 Raj Null
2 Ravi 1
3 Rahul 2
Query
SELECT e.Emp_ID, e.Emp_name
FROM employee AS e INNER JOIN
employee AS m ON e.Manager_ID = m.Emp_ID
Output
Emp_ID Emp_name Manager_ID
2 Ravi 1
3 Rahul 2
Thanks