select country,province,city,sum(amount) from table1
group by grouping sets(country,(country,province),(country,province,city))
等价于:
select country,null as province,null as city,sum(amount) from table1 group by country
union all
select country,province,null as city,sum(amount) from table1 group by country,province
unon all
select country,province,city,sum(amount) from table1 group by country,province,city