-
Who do I write the query on emp table to find out name of the manager of each employee, Following is the basic emp table that oracle provide. Thanks in advance.
EMPNO ENAME JOB MGR
--------- ---------- --------- ----------
7369 SMITH CLERK 7902
7499 ALLEN SALESMAN 7698
7521 WARD SALESMAN 7698
7566 JONES MANAGER 7839
7654 MARTIN SALESMAN 7698
7698 BLAKE MANAGER 7839
7782 CLARK MANAGER 7839
7788 SCOTT ANALYST 7566
7839 KING PRESIDENT
7844 TURNER SALESMAN 7698
7876 ADAMS CLERK 7788
7900 JAMES CLERK 7698
7902 FORD ANALYST 7566
7934 MILLER CLERK 7782
-
select e.empno,e.ename,
m.empno, m.ename
from emp e, emp m
where
e.mgr = m.empno;
-
you use inner join for this purpose
soemthing like
Code:
select a.ename boss, b.ename employee
from emp a, emp b
where a.empno=b.mgr
/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|