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)