JackQu的程序员博客

欢迎来的我Blog.这里记录工作学习的点滴,愿与大家分享。欢迎大家共同交流 。

导航

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

posted on 2017-11-23 17:33  Qcj  阅读(2348)  评论(0编辑  收藏  举报