greetings
I have this sql and want to count/group by.
SQL> select SUBSTR(msg, INSTR(msg, 'ORA-', -4),9) as ERR FROM sysman.mgmt$events where MSG like '%ORA-%' and rownum < 6;
ERR
------------------------------------
ORA-12505
ORA-12505
ORA-12505
ORA-28000
ORA-28000
Group by fails
select count(*), SUBSTR(msg, INSTR(msg, 'CRS-', -4),8) as ERR FROM sysman.mgmt$events where MSG like '%CRS-%' and rownum < 6 group by ERR;
ERROR at line 1:
ORA-00904: "ERR": invalid identifier
any tips is appreciated thanks!