select modified_by, (case when modified_by = (select modified_by from rxc.received_dcis where clinical_study_id = 40613 and RECEIVED_DCI_STATUS_CODE like 'REMOVED' and patient like '01%' group by modified_by having count(received_dci_id) = (select max(cnt) from (select modified_by, count(received_dci_id)cnt from rxc.received_dcis where clinical_study_id = 40613 and RECEIVED_DCI_STATUS_CODE like 'REMOVED' and patient like '01%' group by modified_by))) then (select max(cnt) from (select modified_by, count(received_dci_id)cnt from rxc.received_dcis where clinical_study_id = 40613 and RECEIVED_DCI_STATUS_CODE like 'REMOVED' and patient like '01%' group by modified_by)) end)"Pt 1" from rxc.received_dcis group by modified_by / then (select max(cnt) * ERROR at line 16: ORA-00979: not a GROUP BY expression