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

 表一 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)

posted @ 2010-04-13 19:25  Blue Sky ......  阅读(410)  评论(1编辑  收藏  举报