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

what is the difference between truncate and delete statement? : Transact sql

548


What is optimistic concurrency control? : Transact sql

552


What is sqlexception in java?

549


What is the meaning of disabling a trigger?

646


What are stored procedures used for?

536






Why do we use sql constraints? Which constraints we can use while creating database in sql?

547


Mention what does the hierarchical profiler does?

561


How can I tell if sql is running?

586


How many types of keys are there in sql?

554


What is primary key and foreign key?

533


What does 0 mean in sql?

528


What is keys and its types?

541


How can you get sql*loader to commit only at the end of the load file? : aql loader

553


Explain about various levels of constraint.

523


Why join is faster than subquery?

599