select t1.部门,汇总1,汇总2 from (select 部门,sum(销量) as 汇总1 from 你表名称 where 日期 <= '2006/7/4' group by 部门) as t1 full join (select 部门,sum(销量) as 汇总2 from 你表名称 where 日期 > '2006/7/1' group by 部门) as t2 on t1.部门=t2.部门
也可以这样
select 部门,sum(case 日期 when 日期<= '2006/7/4' then 销量 else 0 end) as 汇总1, sum(case 日期 when 日期 > '2006/7/1' then 销量 else 0 end) as 汇总2
from 你表名称 group by 部门