sql语句update通过另外的表更新本表数据为何不行啊???:
update s set s.qty=s.qty+b.qty
 from stock s,person b
 where s.per_no=b.per_no
 and b.per_no='02';

解决方案 »

  1.   

    update stock  s set s.qty=s.qty+(select qty from person b where s.per_no=b.per_no
     and b.per_no='02';)
      

  2.   

    sql server的写法跟oracle的写法不一样啊
      

  3.   


    update stock s set qty=qty+(select qty from person where s.per_no=per_no and per_no='02')merge into stock s using person b on(s.per_no=b.per_no and b.per_no='02')
    when matched then update set s.qty=s.qty+b.qty