select ((floor(timestamp/3600)%24)*3600)+1800, count(*), count(case when email = 'sage' then 1 else NULL end) from `ic` use index(timestamp_index) where timestamp > 1685418698-86400 and subnum != 0 group by floor(timestamp/3600)%24 order by floor(timestamp/3600)%24;