+ -
当前位置:首页 → 问答吧 → update tableA,tableB set tableA.col1=tableB.col1问题

update tableA,tableB set tableA.col1=tableB.col1问题

时间:2011-09-06

来源:互联网

update tableA,tableB set tableA.col1=tableB.col1, tableA.col2=tableB.col2

tableA里面的col1字段是主键,tableB里面有两个字段,分别是:col2(对应tableA里的col1),col2.

我更新的时候,需要根据tableA的ID来更新数据。

请问该如何实现啊。

作者: cocoj   发布时间: 2011-09-06

你还是学学SQL吧。
你给的语句纯粹是瞎凑的。。。你updat里写个tableB干嘛。。
给你条语句参考
  1. update teacher t set t.img_url=(select url from appendix where type_id=2 and app_type=2 and owner_id=t.id and url is not null);
复制代码

作者: iminto   发布时间: 2011-09-06

相关阅读 更多

热门下载

更多