The SQL script
select eventid_nbr, trunc(received_date, 'DD'), sentindicator, count(eventid_nbr) as count
from eventlog
where received_date between to_date('2017-07-01, 10:00 A.M.','YYYY-MM-DD, HH:MI A.M.') and to_date('2017-07-01, 11:00 A.M.','YYYY-MM-DD, HH:MI A.M.')
group by eventid_nbr, trunc(received_date, 'DD'), sentindicator
order by count desc, trunc(received_date, 'DD');
has output
EVENT RECEIVED_DATE SENTINDICATOR COUNT
1 01-JUL-17 Y 128
1 01-JUL-17 E1 2
104 01-JUL-17 Y 55
105 01-JUL-17 Y 4
106 01-JUL-17 Y 3
whereby I need the maximum count chosen amongst each event whereby the output would appear as
EVENT RECEIVED_DATE SENTINDICATOR COUNT
1 01-JUL-17 Y 128
104 01-JUL-17 Y 55
105 01-JUL-17 Y 4
106 01-JUL-17 Y 3
For each grouping, would I need to select max(count)? How could I achieve this?