B表比A表多了一个roid字段,其他的字段全部相同,现在将B表中B.id=A.id 的内容从B表中更新到A表中,只要几个列,并不是全部列的内容,然后删除B表中B.id=A.id 的记录,请问怎么做啊??
A表id   name   old     login_time         ……(字段)
1    NULL   NULL   2004-3-30     ……B表id   name  old     login_time    ……   roid(字段)
1    AAA   12       NULL          ……   2要求A表记录为:
id   name  old  login_time    ……   
1    AAA   12   2004-3-30     ……

解决方案 »

  1.   

    insert into A(id,name,old,login_time)
    values(select id,name,old,login_time from B);ok!
      

  2.   

    不行啊  出现ORA-00936: missing expression错误啊
    还有办法吗??
      

  3.   

    update a set  name=(select name from b where id=a.id);
    update a set  old=(select old from b where id=b.id);delete from b where exists(select 1 from a where id=b.id);
      

  4.   

    修正一下阿牛的就可以了
    insert into A(id,name,old,login_time)
    select id,name,old,login_time from B;
      

  5.   

    update A set (id,name,old,login_time)=(select id,name,old,login_time from B where b.id=a.id);
      

  6.   

    update A set (name,old,login_time)=(select name,old,login_time from B where b.id=a.id);
      

  7.   

    insert into A(id,name,old,login_time) select id,name,old,login_time from B;
      

  8.   

    ORACLE错误啊!试一下下边的办法:
    update a set col1=b.col1,... where id=(select id from b);  
    commit;
    -- id是主键,否则会出错!
    delete from b where id = (select id from b);
    commit;我感觉,应该和rowid没有关系!