Проблемът е, че поръчвате по нещо, което не е във вашата group by
клауза.
Например, това работи
SQL> with testGroup as ( select 1 as one, 2 as two from dual)
2 select one
3 from testGroup
4 group by one;
ONE
----------
1
Ако order by
колона, която не е във вашата group by
клауза:
SQL> with testGroup as ( select 1 as one, 2 as two from dual)
2 select one
3 from testGroup
4 group by two;
select one
*
ERROR at line 2:
ORA-00979: not a GROUP BY expression
Ако редактирате group by
клауза за обработка на колоната, от която се нуждаете в order by
:
SQL> with testGroup as ( select 1 as one, 2 as two from dual)
2 select one
3 from testGroup
4 group by one, two;
ONE
----------
1
SQL>