关于Mysql用not in 删除问题

mysql比较恶心的一个delete in操作
mysql中 

  delete from tableA where id not in (1,2,3)

是没有问题的

  delete from tableA where id not in (select id from tableB

也是木有问题的

但是  

  delete from tableA where id not in (select id from tableA )

就TMD有问题了 

解决办法是建立表别名

   delete from tableA ( select * from (select id from tableA) t)

你可能感兴趣的:(关于Mysql用not in 删除问题)