2个表A和B,都有字段C,其中A表是全表(数据全),B表不全,现在找出B表中C字段在A表出现的数据并修改A表的D字段,请问怎么写SQL语句?  本来我想用IN来找并修改的,但由于数据有5万条会不会太慢?

解决方案 »

  1.   

    update a inner join b 
    on a.c=b.c
    update a.d='xxx'
      

  2.   

    [Err] 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 'update  a.d='xxx' at line 2最后一行报错了,当然我这里把上面报错的地方改了。
      

  3.   

    update A,B
    set A.d=A.c
    where A.c=B.c