今天做了个操作
如果用in
delete from a where a.email in (select email from b)
exists呢? 很多人会写成这样:
delete from a where exists(select email from b)
本来想把a中包含b的email的字段都删除
结果可想,把a全都干掉了
exists的作用是判断的作用
我的语句相当与
delete from a whereexists(1=1)
将语句改为
delete from a where exists(select email from b where a.email=b.email)
就行了