数据库更新表数据,从另一个表中取值
UPDATEA set A.C=B.CfromtableAas A(别名),tableB asB (别名)where A.列= B.列当A表与B表某个字段值相等时,更新A表某列值等于B表某列值
·
SQLServer中
UPDATE A set A.C=B.C
from tableA as A(别名),tableB as B (别名)
where A.列= B.列
MySQL中
UPDATE tableA as A
inner join tableB as B
on A.列= B.列
set A.C=B.C
当A表与B表某个字段值相等时,更新A表某列值等于B表某列值
DB2中
UPDATE A_TEST as atest
set atest.ORG_CODE=(select ctest.code from C_TEST ctest where atest.id = ctest.id)
where atest.id in (select ctest.id FROM TEST ctest);
更多推荐
已为社区贡献1条内容
所有评论(0)