先创建一个相同的临时表
create temporary table ds(id int(10),name varchar(10),age varchar(10),sex varchar(10));
向临时表中插入已经去重复的数据
insert into ds select DISTINCT * from na;
删除原先的表里的数据
delete from na;
从l临时表中取数据并且插入回去
insert into na select * from ds;
create temporary table ds(id int(10),name varchar(10),age varchar(10),sex varchar(10));
insert into ds select DISTINCT * from na;
delete from na;
insert into na select * from ds;
本文标题:Mysql去重复字段数据
本文链接:https://www.haomeiwen.com/subject/exkkwftx.html
网友评论