你看这样可以满足你的要求吗?select top 3000 wzdm as 尺码,sum(o_sl) as 销售数量,sum(o_zke) as 销售金额 from (select substring(wzdm,13,3) as wzdm,sum(o_sl) as o_sl ,sum(o_zke) as o_zke from vwokhtotal1 where o_date>='2006-1-1' and o_date<'2006-2-1' Group by wzdm) as tmp group by tmp.wzdm union select '' ,sum(o_sl),sum(o_zke)from vwokhtotal1 where o_date>='2006-1-1' and o_date<'2006-2-1' order by 销售金额 desc
select * from (select top 3000 wzdm as 尺码,sum(o_sl) as 销售数量,sum(o_zke) as 销售金额 from (select substring(wzdm,13,3) as wzdm,sum(o_sl) as o_sl ,sum(o_zke) as o_zke from vwokhtotal1 where o_date>='2006-1-1' and o_date<'2006-2-1' Group by wzdm) as tmp group by tmp.wzdm order by 销售金额 desc) a union select '' ,sum(o_sl),sum(o_zke)from vwokhtotal1 where o_date>='2006-1-1' and o_date<'2006-2-1'
where o_date>='2006-1-1' and o_date<'2006-2-1' Group by wzdm) as tmp group by tmp.wzdm
union
select '' ,sum(o_sl),sum(o_zke)from vwokhtotal1 where o_date>='2006-1-1' and o_date<'2006-2-1'
order by 销售金额 desc
where o_date>='2006-1-1' and o_date<'2006-2-1' Group by wzdm) as tmp group by tmp.wzdm order by 销售金额 desc) a
union
select '' ,sum(o_sl),sum(o_zke)from vwokhtotal1 where o_date>='2006-1-1' and o_date<'2006-2-1'