UPDATE b SET COUNT =(SELECT b1.COUNT+a1.COUNT FROM b b1,a a1 WHERE a1.NAME = b1.NAME AND b.NAME = a1.NAME)

解决方案 »

  1.   

    UPDATE b SET COUNT =(SELECT b1.COUNT+a1.COUNT FROM b as b1,a as a1 WHERE a1.NAME = b1.NAME AND b.NAME = a1.NAME)
      

  2.   

    update b set b.count = b.count + a.count from a join b on a.name = b.name
      

  3.   

    SQL 查询 :  UPDATE testb SET testb.c = testb.c + testa.c FROM testa JOIN testb ON testa.id = testb.id MySQL 返回:
    #1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM testa JOIN testb ON testa.id = testb.id' at line 1 
      

  4.   

    UPDATE testb SET testb.c = testb.c + testa.c where testa.id = testb.id 
    这样行不?
      

  5.   

    #1109 - Unknown table 'testa' in where clause失败。
      

  6.   

    可能因为上面那句,没有from testa,所以被认为找不到testa吧。
      

  7.   

    UPDATE testb,testa SET testb.c = testb.c + testa.c WHERE testa.id = testb.id
    这个可以