0

Getting the error ORA-00979: not a GROUP BY expression. I'm not sure why this is happening. Everything seems correct. Am I missing something blatantly obvious here?

SELECT  to_number(CALOT_AWD_YR),
    CALOT_TPC,         
    ATCAT_ALLOT_NBR,
    ATCAT_TCAT,
    SUM(CALOT_AMT_FUNDED),
    ATCAT_C_OR_D_IND

FROM MYSCHEMA.STG_TED_CLNT_ALLOT_TAB, 
 MYSCHEMA.STG_TED_ALLOT_TCAT
WHERE  CALOT_TPC       =   ATCAT_TPC
 AND  CALOT_AWD_YR    =   ATCAT_AWD_YR
 AND  CALOT_ALLOT_NBR =   ATCAT_ALLOT_NBR
 AND  CALOT_TPC       in ( 'DL' , 'PL' , 'TH' )
GROUP BY CALOT_AWD_YR,
     CALOT_TPC,
     ATCAT_ALLOT_NBR,
     ATCAT_TCAT  

ORDER BY CALOT_AWD_YR,
     CALOT_TPC,
     ATCAT_ALLOT_NBR,
     ATCAT_TCAT;
Mureinik
  • 297,002
  • 52
  • 306
  • 350
user2665166
  • 441
  • 4
  • 8
  • 17

2 Answers2

3

You need to group by ATCAT_C_OR_D_IND as well

kevinskio
  • 4,431
  • 1
  • 22
  • 36
2

The column ATCAT_C_OR_D_IND in your select list isn't in the group by clause. You either need to remove it from the select list, apply some aggregate function to it, or add it to the group by clause in order to make your query legal.

Mureinik
  • 297,002
  • 52
  • 306
  • 350