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

select e1.ename EmpName,e2.ename MgrName from emp e1,emp e2
where e1.mgr_id=e2.ename;

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you use join?

524


What is difference between sql and oracle?

568


what are the differences between char and varchar? : Sql dba

529


What is minus?

547


What are primary key and foreign key and how they work?

554






What is 19 null in sql?

534


How do you sort in sql?

604


What is difference between sql and excel?

515


what is a trigger in mysql? Define different types of trigger. : Sql dba

552


Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?

671


What are sql data types?

548


How does pl sql work?

528


Is microsoft sql free?

604


what is the syntax for using sql_variant_property? : Transact sql

533


How many databases can sql express handle?

536