您的位置:首页 > 数据库

SQL 用B表数据更新A表数据

2016-05-20 08:44 375 查看
Way1

update A set A.sCard = B.sCard

from A,B

where A.sName = B.name

Way2

update a set sCard=(select b.card from b where name=a.sName)

我今天需要修改系统数据,用批量上传的表更新原有数据。在网上找到了上面两种方法。

第一种在as400上不可用。

第二种试了可以的,不过最好在加上限制。

语句如下:

update acustm set acustm.AYAREA = (select substr(AYSORT,1,6) from tylib/cust where AYCUST = ACUSTM.AYCUST) where AYCUST in (select AYCUST from tylib/cust)

615 rows updated in ACUSTM in R5ASPPROD.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: