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
Can variables be used in sql statements?
What is the need of a partition key?
What are different types of queries in sql?
How do you determine the current isolation level? : Transact sql
Why join is faster than subquery?
What is dml and ddl?
what is the different between now() and current_date()? : Sql dba
What are data types in pl sql?
define sql update statement ? : Sql dba
what is the difference between blob and text? : Sql dba
How to assign sql query results to pl sql variables?
What is pl/sql language case sensitive?
Define SQL and state the differences between SQL and other conventional programming Languages?
What steps server process has to take to execute an update statement?
What is the use of prepared statement?