1.单字段 ---查重
select * from fa_chickensoup where content in
(select content from fa_chickensoup group by content having count(content)>1);
2.单字段---查重(已排除最小id的数据)
select * from fa_chickensoup where content in (select content from fa_chickensoup group by content having count(content)>1)
and id not in(select min(id) from fa_chickensoup group by content having count(content)>1)
第二个sql查询出来的数据直接删掉就好了
博客介绍了MySQL单字段查重的SQL语句,一是直接查询重复数据,二是查询重复数据并排除最小id的数据,还提到可直接删除第二个查询结果的数据。
8902

被折叠的 条评论
为什么被折叠?



