SQL Server 中如何用一个表的数据更新另一个表中的数据

原帖地址:http://www.cnblogs.com/emanlee/archive/2009/07/24/1530455.html

for ACCESS 数据库:
update a, b set a.name=b.name1 where a.id=b.id

for SQL Server 数据库:
update a set a.name=b.name1 from a,b where a.id=b.id

实例:

UPDATE a
SET a.[CreatedOn]=b.[Created]
FROM [tbm_trn_Transaction] a,[tbm_trn_Transaction_Redemption]b
WHERE a.[TransactionID]=b.[TransactionID]
AND b.[Created] IS NOT NULL

你可能感兴趣的:(数据库相关)