select bh,mc,max(sl)as expr,sum(xfwh.sl*xfwh.yl*xfwh.jg)as expr2
from xfjlb,xfwh
where (sx<>3) and (xfwh.cpbh=xfjlb.bh)and(xfwh.sj=xfjlb.sj)
group by bh,mc;
from xfjlb,xfwh
where (sx<>3) and (xfwh.cpbh=xfjlb.bh)and(xfwh.sj=xfjlb.sj)
group by bh,mc;
from xfjlb,xfwh
where (sx<>3) and (xfwh.cpbh=xfjlb.bh)and(xfwh.sj=xfjlb.sj)
from (select xfjlb.bh,xfjlb.mc,sum(xfjlb.sl)as expr
from xfjlb
where (xfjlb.sx<>3)
group by xfjlb.bh,xfjlb.mc) table1
left join
(select cpbh,sj,sum(xfwh.sl*xfwh.yl*xfwh.jg)as expr2 from xfwh group by cpbh,sj) table2
on (table2.cpbh=table1.bh)and(table2.sj=table1.sj)