i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee respective manager.. example
empno ename mgr_id
1 john 3
2 paul 3
3 smith 1
4 kevin 1
5 stewart 2
result has to look like this
ename manager
john smith
paul smith
smith john
kevin john
stewart paul
can u plz help me out in this.....
Answer Posted / cbigmudre
select a.ename, b.enanme as manager
from emp as a, emp as b
where a.empno = b.mgr_id
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are keys in sql?
What is difference between db2 and sql?
Can we create clustered index without primary key?
what are the other commands to know the structure of table using mysql commands except explain command? : Sql dba
What is pl sql in oracle?
What are the parts of a sql statement?
What is a record in a database?
What is data manipulation language?
When is the explicit cursor used ?
How do you create a unique index?
What do you mean by table in sql?
What are the different sql commands?
How can I tell if sql is running?
How do I view a sql trace file?
How to get each name only once from an employee table?