select * from ( (select 产品,班组,sum(产量) from p gorup by 产品,班组) union (select 产品='合计',班组='',sum(产量) form p) ) aaorder by (case aa.产品 when '合计' then 1 else 0 end)
最前: (select 产品,班组,sum(产量) from p gorup by 产品,班组) union (select 产品='合计',班组='',sum(产量) form p) order by 3 desc
(select 产品,班组,sum(产量) from p gorup by 产品,班组) union all (select 产品='合计',班组='',sum(产量) form p)
select 产品,班组,sum(产量) from p gorup by 产品,班组 union select 产品='合计',班组='',sum(产量) form p order by case 产品 when '合计' then 1 else 0 end
select 产品,班组,sum(产量) from test group by 产品,班组 union all select 产品='合计',班组='',sum(产量) from p order by 产品
(select 产品,班组,sum(产量) from p gorup by 产品,班组)
union
(select 产品='合计',班组='',sum(产量) form p) ) aaorder by (case aa.产品 when '合计' then 1 else 0 end)
(select 产品,班组,sum(产量) from p gorup by 产品,班组)
union
(select 产品='合计',班组='',sum(产量) form p)
order by 3 desc
union all
(select 产品='合计',班组='',sum(产量) form p)
union
select 产品='合计',班组='',sum(产量) form p
order by case 产品 when '合计' then 1 else 0 end
union all
select 产品='合计',班组='',sum(产量) from p order by 产品