问题:oracle 两个表之间的修改;结果:ORACLE 两个表之间更新的实现

前提条件:

表info_user中有字段id和name,字段id为索引

表data_user_info中有字段id和name,字段id为索引

其中表info_user中字段id和表data_user_info中字段id数值一致。

要求实现:

更新表info_user中的字段name 与表data_user_info中字段name一致。

实现的SQL语句为:

update info_user i set (i.name) = (select  d.name from data_user_info d where d.id = i.id)
 
  where i.id = (select d.id from data_user_info d where d.id = i.id);

commit;

posted @ 2015-12-14 15:33  longphui  Views(417)  Comments(0Edit  收藏  举报