获取时间戳sid的和
SELECT sum(sid),
case
-- date_>'20220301' and date_<'20220403' 这个时间范围,作为'20220301-20220403'输出
when date_>'20220301' and date_<'20220403' then
'20220301-20220403'
when date_>'20220422' and date_<'20220603' then
'20220422-20220505'
end aa -- 将时间戳取名为 aa
from clazz GROUP BY aa --按时间戳进行分组计算 sum(sid)
结果: