try:
  update a set a.aa=(select b.bb from b.bb where a.c=b.x)

解决方案 »

  1.   

    如果有多行:
    update a set a.aa=(select b.bb from b where a.c=b.x and rownum=1)
      

  2.   

    update a t1
    set aa = (
        select bb
        from b t2
        where t1.c = t2.x
    )
      

  3.   

    update a set a.aa=(select b.bb from b where a.c=b.x)这个九可以,测试通过了,需要a的c字段和b的x字段是主键
      

  4.   

    如果 a.c!=b.x 呢 是不是 a.aa 会被更新为 null
    update tset ( x,y,z) 
           = ( select x,y,z
               from t1
               where t.x ==t1.x)
       where exists 
    ( select x,y,z
               from t1
               where t.x ==t1.x)
    Why is it necessary to give the whole query, woudnt it suffice to just say
    update tset ( x,y,z) 
           = ( select x,y,z
               from t1
               where t.x ==t1.x)
       where t.x =: some value we know 
    Followup:  that doesn't make sense.  where did you get "some value you know"the first query with the where exists -- that will update every row in T with a 
    value in T2 given that a row exists in T2 to update t withyour query will update every row in T where t.x = some_value -- if no values 
    exist in T2, t.x,y,z will be set to NULL
    they are totally different
      

  5.   

    update a set a.aa=(select b.bb from b where a.c=b.x) where exists(select 1 from b where a.c=b.x)
    多行要加个条件