update t1 set ns=b.ns from t1,t2 where t1.id=t2.id
这在SQL SERVER中是可以通过的,但在ORACLE中无法通过

解决方案 »

  1.   

    update t1 set ns=nvl
    (
      (select ns from t2 where t1.id=t2.id and rownum=1),
      ns
    )
      

  2.   

    如果id唯一的话
    update t1 set t1.ns = (select t2.ns from t2 where t1.id = t2.id)
      

  3.   

    update t1 set ns = (select ns from t2 where t2.id=t1.id and rownum=1 )
      

  4.   

    update t1 set t1.ns = (select t2.ns from t2 where t1.id = t2.id) where exists(select 1 from t2 where t1.id = t2.id)
      

  5.   

    ORARichard(没钱的日子好难过啊) 的对,
    上面的语句如果,t1.ns列本来就用数据的话,那些在t2里找不到对应id的ns会更新成空。