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
What is a left join?
What plvcmt and plvrb does in pl/sql?
How do I edit a trigger in sql developer?
Explain what is table in a database?
what is the difference between a web-garden and a web-farm? : Sql dba
Which is faster count (*) or count 1?
What is update query?
How do I audit the sql sent to the server?
What is the use of desc in sql?
What is the purpose of a sql?
mention if it is possible to import data directly from t-sql commands without using sql server integration services? If yes, what are the commands? : Transact sql
What is pl sql package?
Explain isolation levels. : Transact sql
Is sql difficult?
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?