我觉应该这样写:select *from TABLE where dep='AHFB01' union all select dep,SUM(amtn)from TABLE group by dep union all select *from TABLE where dep=' BJBSC...' union all select dep,sum(amtn)from table group by dep 当然我是基于你这个图片中的结果集来写的,要注意哦,手机打的耗费劲,可能还有更好的方法,你试试我这个
select *from a where a.a1='BJBSC01' union all select 'BJBSC01合计',sum(a3) from a where a.a1='BJBSC01' union all select *from a where a.a1='AFB01' union all select 'AFB01合计',sum(a3) from a where a.a1='AFB01' 就两种类型的话,就这样弄了吧。。