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 / rajesh venati

select e.ename as employee_name,m.ename as manager_name from
emp e, emp m where e.mgr_id=m.empno;

Is This Answer Correct ?    8 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is merge a dml statement?

528


How can triggers be used for the table auditing?

594


Can we edit a view in sql?

552


How do you modify a table in sql?

571


Is left join inner or outer by default?

526






what is the difference between group by and order by in sql? : Sql dba

600


Why cannot I use bind variables in ddl/scl statements in dynamic sql?

670


What are predefined functions in sql?

535


Is sqlexception checked or unchecked?

541


what are the authentication modes in sql server? How can it be changed? : Sql dba

703


How can you get sql*loader to commit only at the end of the load file? : aql loader

556


Explain alias in sql?

584


What is sql select statement?

507


What is the difference between explicit and implicit cursors in oracle?

517


Is it possible to link two groups inside a cross products after the cross products group has been created?

597