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.
when :P33_RG = 'Daily' then
when :P33_RG = 'Weekly' then
to_char(TRUNC(date_sys, 'IW'), 'MM/DD/YYYY')
end as my_date,
sum(BATCH.RECORDS_NUMBER) as Count_of_Documents
where date_sys between :P33_START_DATE and :P33_END_DATE
group by project_name, my_date
Any advice to fix it would be appreciated. Thank!