A表 (ID)
B表 (ID, AID)现想删除B.AID!=A.ID的数据
SQL怎么写
delete from B where B.AID in (select ID from A)
这个为什么错呀

解决方案 »

  1.   

    希望你尽快把错误内容发出来 这样才好解决 我用你写的这个SQL语句没有错误!~
      

  2.   

    B.AID!=A.ID应该是not in 吧
      

  3.   

    mysql> delete from B b where b.aid not in (select id from A);
    ERROR 1064 (42000): 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 'where
     b.aid not in (select id from A)' at line 1in 我的也可以 
    为什么not in 就不可以了
    谢谢