Update 更新语句使用两个表关联

=============错误例子=======================================

update tcodeLocation
set plocationid = p.LocationID
from TcodeLocation t , tcodelocation p where p.locationcode=t.plocationcode 
and t.locationlevel>1 

=============正确=======================================

update t    ---  (使用别名)
set plocationid = p.LocationID
from TcodeLocation t , tcodelocation p where p.locationcode=t.plocationcode
and t.locationlevel>1

原文地址:https://www.cnblogs.com/CNQCJ/p/7886053.html