SQL更新语句问题

cheny 2003-08-19 05:14:42

有表table1 字段ID,a,b,c,d
表table2 字段ID,c,d,e,f
要根据ID相等把table2的c,d数据更新到table1中应该怎么写呀
sqlserver很简单,oracle不熟悉,请教一下
...全文
21 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2003-08-19
  • 打赏
  • 举报
回复
update table1 a set (c,d) = (select c,d from table2 where id = a.id)
yuxuan 2003-08-19
  • 打赏
  • 举报
回复
update table1 a set c,d = (select c,d from table2 where id = a.id)
bluemeteor 2003-08-19
  • 打赏
  • 举报
回复
总要有点条件吧...
update set ta1.c=ta2.c where...
tcmis 2003-08-19
  • 打赏
  • 举报
回复
update table1 a set c = (select c from table2 where id = a.id),d = (select d from table2 where id = a.id);

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧