update id set A=(select A from id,ida where id.id=ida.id),B=(select B from id,ida where id.id=ida.id),C=(select C from id,ida where id.id=ida.id)

解决方案 »

  1.   

    update id t1 set a=(select t2.a from ida t2 where t1.id=t2.id),b=(select t2.b from ida t2 where t1.id=t2.id),c=(select t2.c from ida t2 where t1.id=t2.id)
      

  2.   

    delete from id where id in (select id from ida);
    insert into id select * from ida;
      

  3.   

    还少一句条件
    where t1.id=t2.id
      

  4.   

    delete from id where id in (select id from ida);
    insert into id select * from ida where id.id=ida.id; 
      
      

  5.   

    update id set (a,b,c)=(select a,b,c from ida where ida.id=id.id);
      

  6.   

    或者
    update id t1 set a=(select t2.a from ida t2 where t1.id=t2.id),b=(select t2.b from ida t2 where t1.id=t2.id),c=(select t2.c from ida t2 where t1.id=t2.id) where t1.id in(select t3.id from id t3,ida t4
    where t3.id=t4.id)
      

  7.   

    update id t1 set a=(select t2.a from ida t2 where t1.id=t2.id),b=(select t2.b from ida t2 where t1.id=t2.id),c=(select t2.c from ida t2 where t1.id=t2.id) where exists (select * from id,ida where id.id=ida.id)
      

  8.   

    myxchy(阿呆) :
    我的数据库是8.1.7,语句我已经验证过了,正确!
      

  9.   

    update a set a.a = b.a , a.b = b.b , a.c=b.c from id a , ida b where a.id = b.id
      

  10.   

    楼上的与具有错误,不过思路挺好,但没有调出来,它可能做到一条语句更新多个表的
    black_dragon(半仙)的方法非常好
      

  11.   

    楼上的楼上。你以为ORACLE是SQLSERVER 或是SYBASE 呢。半仙是对的。应该没有什么问题。
      

  12.   

    http://www.itpub.net/showthread.php?s=&threadid=45822&highlight=%BE%AD%B5%E4可以给大家以参考
    注意8i和9i的变化
      

  13.   

    我也有同样的问题,我觉得这些回答好象都不太好吧,因为如果两表的数据是一对多的,会发现返回多行数据的情况,就不好解决了但是我记得在某书中见一过,想不起来了,我也想知道一个好的UPDATE的方法