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

What are the two types of periodical indexes?

660


What is the use of %rowtype?

746


What is difference between mysql and postgresql?

704


Can we use distinct and group by together?

783


What is record data type?

677






How to run pl sql program in mysql?

681


How many types of tables are there?

692


What is the usage of the distinct keyword?

889


What are different types of functions in sql?

723


Is sql a scripting language?

690


Is primary key clustered index?

687


How do I remove all records from a table?

764


What are different types of triggers?

738


What are the packages in pl sql?

742


What are different types of tables in sql?

700