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
What are the types of operators available in sql?
Can we insert delete data in view?
how to use case expression? : Sql dba
How can we avoid duplicating records in a query?
How do you update sql?
What is the difference between delete and truncate commands?
Can we create table in function?
what is innodb? : Sql dba
what is 'mysqlcheck'? : Sql dba
Why functions are used in sql?
When is a declare statement required?
Is a table valued function object?
What is trigger in sql and its types?
What are different types of triggers?
Why do you partition data?