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 / karthik
select e1.empno,e1.ename EmpName,e2.ename MgrName from emp e1,emp e2
where e1.mgr_id=e2.ename(+);
select e1.empno,e1.ename EmpName,e2.ename MgrName
from emp e1 left outer join emp e2
where e1.mgr_id=e2.ename;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to read xml file in oracle pl sql?
What is dense_rank in sql?
what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba
How many rows can sqlite handle?
What is difference between table and view?
Can we update views in sql?
How to avoid duplicate records in a query?
How to change sql*plus system settings?
How to write a query to show the details of a student from students table whose
how can we take a backup of a mysql table and how can we restore it. ? : Sql dba
Difference between truncate, delete and drop commands?
Why use truncate instead of delete?
what is error ora-03113: end-of-file on communication channel?
What are the different types of triggers?
What is recursive stored procedure?