update a set ch =(select ch from b where a.id=id)

解决方案 »

  1.   

    以下语句在8i上运行通过
    ========================================================
    SQL> select * from a;        ID SM
    ---------- ------------------------------
             1 bad1
             2 bad1
             3 bad1SQL> select * from b;        ID SM
    ---------- ------------------------------
             1 good1
             2 good2
             3 good3SQL> update a set a.sm = (select b.sm from b where a.id = b.id and rownum<=1);3 rows updatedSQL> select * from a;        ID SM
    ---------- ------------------------------
             1 good1
             2 good2
             3 good3SQL> select * from b;        ID SM
    ---------- ------------------------------
             1 good1
             2 good2
             3 good3SQL>