select
${if(len(area)=0,"county_name",if(area="北京市"||area="重庆市"||area="天津市"||area="上海市","city_name","province_name"))} as 字段,sum(金额) as 金额
from 表名称
group by ${if(len(area)=0,"county_name",if(area="北京市"||area="重庆市"||area="天津市"||area="上海市","city_name","province_name"))}
-------------------修改后的语句--------------------------
select
${if(len(area)=0,"province_name",if(area="北京市"||area="重庆市"||area="天津市"||area="上海市","county_name","city_name"))} as 字段,sum(金额) as 金额
from 表名称
group by ${if(len(area)=0,"province_name",if(area="北京市"||area="重庆市"||area="天津市"||area="上海市","county_name","city_name"))}