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

What are the types of operators available in sql?

554


Can we insert delete data in view?

544


how to use case expression? : Sql dba

552


How can we avoid duplicating records in a query?

567


How do you update sql?

523






What is the difference between delete and truncate commands?

515


Can we create table in function?

572


what is innodb? : Sql dba

579


what is 'mysqlcheck'? : Sql dba

575


Why functions are used in sql?

513


When is a declare statement required?

677


Is a table valued function object?

582


What is trigger in sql and its types?

536


What are different types of triggers?

562


Why do you partition data?

536