标签:没有 group by 重复数据 having HERE _id 数据 bsp let
数据库中存在大量的重复内容,并且存在着外键关系
先删除外键的,以内容分组,查询条数大于一的,将该id在多对多的表中删除
delete from poem2cls where poem_id in(select id from (select id,count(*)as count from poem group by content having count>1)as a);
然后在删除拥有重复内容的表中的重复数据
delete from poem where id in(select id from (select id,count(*)as count from poem group by content having count>1)as a);
然后循环,直至没有重复内容
标签:没有 group by 重复数据 having HERE _id 数据 bsp let
原文地址:https://www.cnblogs.com/wwg945/p/9181248.html