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 partition and index?

493


what are the limitations of mysql in comparison of oracle? Mysql vs. Oracle. : Sql dba

557


What is the difference between execution of triggers and stored procedures?

560


Which join condition can be specified using on clause?

524


Can pl sql procedure have a return statement?

560






What is difference between pls_integer and integer?

526


What is the current version of postgresql?

568


What are all the different normalizations?

593


how to return query output in html format? : Sql dba

661


What is cursor in pl sql with examples?

490


What is db journal file?

528


what is cross join? : Sql dba

581


what is the difference between $message and $$message? : Sql dba

559


what is a primary key? : Sql dba

562


What is pl sql block structure?

551