我需要一个效果:
update tb1 set a = (select b from tb2 where tb1.c = tb2.c)
要求:该结果集必然包含多个查询结果,理论上会报错。我想将此结果集用逗号之类连接起来更新进去使该语句不报错并达到效果,不能用循环后再udate
感谢~

解决方案 »

  1.   

    update tb1 set a = (select b from tb2 where tb1.c = tb2.c)//在select b from tb2 where tb1.c = tb2.c为一条记录的时候不会出错吧
      

  2.   

    一条记录当然不会出错..现在是一般有多条记录,但是想将多个查询结果连接起来update进去..
      

  3.   

    //update tb1 set a = (select b from tb2 where tb1.c = tb2.c) 
    update tb1 set a=tb2.b
    from tb1,tb2 where tb1.c=tb2.c
      

  4.   

    select b from tb2 where tb1.c = tb2.c如果有从个结果,那是不太好办了!
      

  5.   

    to:unsigned 
    只更新进末尾一条记录的数据.不是全部.
    果然是没有办法了吗?....
      

  6.   

    子查询不报错吗?
    只from tb2,where 条件里却有tb1?