两表更新:根据条件从一个表里面查询出符合条件的结果更新另一个表

 表一 App

 表二 Screenshot

下面语句的意思: 根据表Screenshot里面的外键AppId=App.Id 把 ScreenshotUrl值赋给App 表的Url

update App set Url=(select Screenshot.ScreenshotUrl from Screenshot where AppId=App.Id and Screenshot.No=0)

转载于:https://www.cnblogs.com/hubcarl/archive/2010/04/13/1711319.html

猜你喜欢

转载自blog.csdn.net/weixin_33709609/article/details/93817293
今日推荐