select 年,月,舆情数 from ( select 年,月,业务分类,count(流水号) as 舆情数 from 舆情总表 group by 年,月,业务分类 union all select 年,月,'总计' as 业务分类,count(流水号) as 舆情数 from 舆情总表 group by 年,月 ) m where 1=1 ${if(len(c)==0,"","and 业务分类='"+c+"'")} order by 月