I have this query
SELECT EMPNO, ENAME, HIREDATE, DEPTNO, ROWNUM AS rn
FROM (SELECT EMPNO, ENAME, HIREDATE, DEPTNO FROM EMP ORDER BY HIREDATE DESC)
WHERE rn < 3
but the error is:
ORA-00904: "RN": invalid identifier 00904. 00000 - "% s: invalid identifier" * Cause:
* Action: Error in the line: 34, column: 7
How can I make it work that way or another?