你如果需要连表删除 ,必须先删除 子表 ,delete from childTable a,parentTable bwhere a. fk= b.id and b.id not in ('2','7');然后再删除 父表delete from tablewhere id not in ('2','7')
delete from tablewhere id not in ('2','7')