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

I think this one will work
Select a.ename as Employee ,b.ename as Manager from
EMP ,EMP B
where
A.MGR_ID=B.empno

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many sql databases can you have on one server?

756


what is query cache in mysql? : Sql dba

761


Are sql database names case sensitive?

685


how to get a list of columns in an existing table? : Sql dba

709


how to shutdown mysql server? : Sql dba

743






Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints

842


Write a query to display the current date in sql?

737


What does stand for in sql?

715


What is meant by user defined function?

761


Can we commit inside a trigger?

732


What programs use sql?

729


Explain the advantages and disadvantages of stored procedure?

853


Explain the commit statement.

848


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

748


Does truncate remove indexes?

721