// 1、第一种查询方式
select substr(time,1,6) as time count(id) as con,src_system_type as srcSystemType from(
select id,time,src_system_type from test_table where yup_partitions like 'test_table_%'
and time >='20200106000000'
and time <='20210106000000')t group by substr(time,1,6),src_system_type
// 2、第二种查询方式withcr1 as (select id,time,src_system_type from test_table where yup_partitions like 'test_table_%'
and time >='20200106000000'
and time <='20210106000000'),cr2 as (select substr(cr1.time,1,6)as time,cr1.id,cr1.src_system_type from cr1)select cr2.time,count(cr2.id)as con,src_system_type as srcSystemType from cr2 group by cr2.time,cr2.src_system_type
// 1、第一种查询方式select substr(time,1,6) as time count(id) as con,src_system_type as srcSystemType from(select id,time,src_system_type from test_table where yup_partitions like 'test_table_%' and time >='20200106000000'and time <='20210106000000')t g