db 12c, Apex 18.2, win 7.
Hi,
- I am trying to sort scott.emp table's data by hiredate column after I converted it to MM-YYYY format in the select list and added a group by clause.
SELECT
TO_CHAR( hiredate, 'MM-YYYY' ) HIRE
FROM
emp
GROUP BY
TO_CHAR(HIREDATE,'MM-YYYY')
ORDER BY
HIREDATE;
- It shows "ORA-00979: not a group by expression" when there is not a problem with the GROUP BY clause as the error is solved when removing the ORDER BY clause not the GROUP BY clause.
Edited:
1- Why the error?
2- How to sort the data correctly?
edited the title to be more specific: Eslam_Elbyaly