select count(*),t.分组字段 from (select t.* ,to_char(t.时间,'HH24') stime,to_char(t.时间,'HH24mi') fz,to_char(时间,'d') from A twhere 时间>=to_date('2019-12-01','yyyy-MM-dd') and ghsj<=to_date('2019-12-31','yyyy-MM-dd') and to_char(时间,'d')='2') where stime in (…