如题所述
这种情况下在单表下是可以的,如果是有外键联系的情况下就会出错啊!怎么办
有外键的话 需要先删除外键的数据 才能再删除主表的数据 比如外键到table2delete from table2 where exists (select 1 from table where table2.id=table.id and table.id not in ('2','7'))