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 / monika

select empno,ename
from emp
start with mgr_id is null
connect by prior empno=mgr_id;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does truncate release storage space?

767


what is union, minus and interact commands? : Sql dba

860


What is the difference between microsoft access and sql?

725


Explain correlated query work?

791


When is the explicit cursor used ?

764






how to use 'mysql' to run sql statements? : Sql dba

738


Can we update views in sql?

686


What programs use sql?

729


What is exception? What are the types of exceptions?

789


What are the different types of dbmss?

747


What do you mean by field in sql?

785


Write a sql query to find the names of employees that begin with ‘a’?

743


Is sqlite free?

718


What is the difference between union and union all command?

740


How do I restart sql?

722