直接使用月份除以3向上求整,就可以分类季度了
由于month是yyyyMM格式,先通过substr截取后面两位
select ceil(substr(month,-1,2)/3) as qtr,sum(city_count) as cunt
from table
where employee_id='620118508'
and ceil(substr(month,-1,2)/3=ceil(substr(sysdate,6,2)/3)
group by ceil(substr(month,-1,2)/3