1. 利用mysqlimport --local dbname data.txt导入数据到表中,表名要与文件名一致
2. 执行下列sql语句(要求唯一的字段为uniqfield)
复制代码
代码如下:use dbname;
alter table tablename add rowid int auto_increment not null;
create table t select min(rowid) as rowid from tablename group by uniqfield;
create table t2 select tablename .* from tablename,t where tablename.rowid= t.rowid;
drop table tablename;
rename table t2 to tablename;