如何从另一个表中的列更新列

时间:2013-09-25 12:01:34

标签: sql sql-server-2008-r2

可能有更好的方法,但这对我有用:

 Update t1 
 set t1.ListKey = t2.ListKey
 From Jet.LookupListItemEntity_Default t1 
 join (Select ListKey, Id from Jet.LookupListEntity_default) as t2
 on t1.ListId = t2.id

格雷格

1 个答案:

答案 0 :(得分:2)

 Update t1 
 set t1.ListKey = t2.ListKey
 From Jet.LookupListItemEntity_Default t1 
 join Jet.LookupListEntity_default t2 on t1.ListId = t2.id