I have this table:
CREATE TABLE EMP
(EMPNO NUMBER(4) CONSTRAINT EMP_PRIMARY_KEY PRIMARY KEY ,
ENAME varchar2(10),
JOB varchar2(9),
MGR NUMBER(4)CONSTRAINT EMP_SELF_KEY REFERENCES EMP (EMPNO),
HIREDATE DATE,
CONSTRAINT EMP_FOREIGN_KEY REFERENCES DEPT (DEPTNO));
And now I want to get the name (ename), job (job) and manager name (mgr) of all employees.
I thought about this with a join in one table:
SELECT ename, job, empno
FROM emp
INNER JOIN emp AS emp1
ON (emp.mgr = emp1.empno);
But I always get the error: "missing keyword"
source
share