• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
细心,耐心
不是在敲代码,就是在敲代码的路上
博客园    首页    新随笔    联系   管理    订阅  订阅

Oracle 多表关联更新

create table t1(
  id number(10),
  name varchar2(10)
);
create table t2(
  id number(10),
  name varchar2(10)
);

insert into t1 values(1,'06');
insert into t1 values(2,'02');
insert into t2 values(3,'03');
insert into t2 values(1,'01');

select * from t1;
select * from t2;

update t1
set t1.name = (select t2.name from t2 where t2.id=t1.id)
where exists (select * from t2 where t2.id=t1.id) ;

posted @ 2018-08-21 09:35  Stephen_Su  阅读(236)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3