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 do you select unique values in sql?
What is the difference between sql and mysql?
What is the difference between rename and alias?
how to include numeric values in sql statements? : Sql dba
What do you mean by stored procedures?
Is null operator in sql?
what is a table in a database ? : Sql dba
Can we debug stored procedure?
How many triggers can be applied to a table?
Where is sql database stored?
How do I kill a query in postgresql?
Can we use threading in pl/sql?
What are the two types of cursors in pl sql?
What is data type in database?
How many types of triggers are there in pl sql?