update  表a
set 数量=数量+(select  数量 from 表b where 表a.品名=表b.品名)

解决方案 »

  1.   

    update  表a
    set 数量=数量+isnull((select  数量 from 表b where 表a.品名=表b.品名),0)
      

  2.   

    create table a
    (
    品名 varchar(10) ,
    数量 decimal(10,2)
    )
    create table b
    (
    品名 varchar(10) ,
    数量 decimal(10,2)
    )insert into a(品名,数量)
    select '1',1 union
    select '2',4 union
    select '3',5 union
    select '4',3insert into b(品名,数量)
    select '1',4 union
    select '3',5 
    update a set
    数量 = a.数量+b.数量
    from b
    where a.品名 = b.品名select * from a