Skip to Main Content

Recieving error: ORA-00937: not a single-group group function

User_M4XGBDec 20 2022

I am running the following query which is giving the error ORA-00937: not a single-group group function. I tried moving the sum statement outside the subquery which doesn't help.

select *
from (
select project_name, 
  case 
    when :P33_RG = 'Daily' then
      to_char(date_sys, 'MM/DD/YYYY') 
    when :P33_RG = 'Weekly' then
      to_char(TRUNC(date_sys, 'IW'), 'MM/DD/YYYY')
    else
      ('no date')
  end as my_date,  
  sum(BATCH.RECORDS_NUMBER) as Count_of_Documents
from BATCH
where date_sys between :P33_START_DATE and :P33_END_DATE
) my_records
group by project_name, my_date
;

Any advice to fix it would be appreciated. Thank!

Comments
Post Details
Added on Dec 20 2022
2 comments
86 views