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

select a.ename, b.enanme as manager
from emp as a, emp as b
where a.empno = b.mgr_id

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I save the results of sql query in a file?

533


Which language is used in sql?

518


Explain the structure of pl/sql in brief.

617


what is the difference between mysql_fetch_array and mysql_fetch_object? : Sql dba

555


What is crud stand for?

565






how to run 'mysql' commands from a batch file? : Sql dba

607


What is difference between sql and mysql?

529


What is row_number () in sql?

539


What is the usage of sql functions?

542


In pl/sql, what is bulk binding, and when/how would it help performance?

529


What is nested table in pl sql?

553


What is the use of count (*) in sql?

542


What are the different types of constraints?

561


How many tables can a sql database have?

530


Can you do multiple joins in sql?

543