本帖最后由 shinos1979 于 2011-02-03 18:21:48 编辑

解决方案 »

  1.   


    update tb t set 
    (e01,e02,e03)=(select sum(e01),sum(e02),sum(e03) 
     from tb where unit in ('A','B') and t.u01=u01 and t.u02=u02)
    where unit='C';
      

  2.   


    update tb t
    set (e01,e02,e03)=
      (
       select sum(e01),sum(e02),sum(e03)
       from tb
       group by u01,u02
       where unit in ('A','B')
       and t.u01=tb.u01 and t.u02=tb.u02)
    where unit='C';
      

  3.   

    加 group by u01,u02 是画蛇添足