这两个表需要有一一对应的关系
update tab1.set a=(select d from tab2 where a.pk=d.pk);

解决方案 »

  1.   

    实际上是不能对应的,假设要update tab1.b = tab2.e的字段,行的通么?
      

  2.   

    比如说:
    tab1
    a   b   
    1   2   
    1   1
    1   2
    1   2
    tab2
    d   e
    x   2
    y   1
    我的目的就是把tab1中b=2的a update为x,b=1的a update为y当然是根据tab2的e字段了
      

  3.   

    如果要update,两个表的数据总应该有关系吧,
    如果没关系,那只能增加记录。
      

  4.   

    update tab1.set a=(select d from tab2 where tab1.b=tab2.e);