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 query cache in mysql? : Sql dba
What is nested table in pl sql?
What are keys in sql?
What is the difference between rollback and rollback to statements?
How to revise and re-run the last sql command?
how can you create an empty table from an existing table? : Sql dba
How do I pipe the output of one isql to another?
Why schema is used in sql?
What are sql objects?
What is a stored procedure in sql with example?
What is posting?
Which are the different character-manipulation functions in sql?
What is the starting oracle error number? What is meant by forward declaration in functions?
Is mariadb nosql?
What is the difference between instead of trigger and after trigger?