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 / john bershan
self join will accomplish this task.try below query
select a.ename,b.ename as manager from emp a,emp b
where a.empno = b.mgrid;
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Is inner join same as self join?
What are triggers and its types?
Is left join same as inner join?
When sql appeared?
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?
What is a string data type in sql?
what is data control language? : Sql dba
How do I install sql?
What is partition in sql query?
What is a stored procedure in sql with example?
Is mariadb nosql?
What is meant by <> in sql?
How to call a javascript function from pl sql?
What is the difference between the repeatable read and serializable isolation levels? : Transact sql
What are the operators in sql?