Mysql删除重复数据

//查出所有的content唯一的最小id

create table tmp as select min(id) as col1 from test group by content;

//删除重复数据
delete from test where id not in (select col1 from tmp);

//删除临时表
drop table tmp;

 

参考:http://blog.csdn.net/anya/article/details/6407280

http://zhidao.baidu.com/link?url=UkkbXfHKefCh_kGmoBBGDUO2xIa-gq1ZW-P4rMyP-0RadKMosDSK1SWuyqtGhtdFthc8gY4KwVNaFnvQu_TGEq

posted @ 2015-04-23 15:30  wangjinming  阅读(313)  评论(0编辑  收藏  举报