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 the difference between instead of trigger and after trigger?
How many commands are in sql?
What is normalisation and its types?
how to write date and time literals? : Sql dba
What is scalar data type in pl sql?
How many sectors are in a partition?
What are triggers in sql?
How many times can we commit in a loop?
what are the types of subquery? : Sql dba
Why coalesce is used in sql?
What is java sql driver?
What are tables and fields?
What are sql injection vulnerabilities?
Which are sql * plus commands?
What are stuff and replace function?