爱程序网

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

相关文章列表:
关于爱程序网 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助