Update 表二 Set val = a.val + b.val From 表一 b, 表二 a
where b.id1 = @id1, And a.id2=b.id2

解决方案 »

  1.   

    update 表2 set val=val+(select val from 表1 where id1=程序里得到的值 and 表2.id=id2)
      

  2.   

    update 表二 set val = b.val + a.val
    from 表一 a,表二 b
    where a.id2 = b.id and a.id1 = '001'
      

  3.   


    select 表二.id, val=a.val+b.val from 表一,表二 where 表一.name=表二.name
      

  4.   

    use date
    update 表2 set 表2.val=表1.valu+表2.val from 表1,表2
    where 表1.id2=表2.id and 表1.id1=1
    验证通过
      

  5.   

    update table2 set table2.val=table2.val+table1.val from table1,table2 where table1.id2=table2.id and table1.id1=1