1. create table mon_msg2 as select distinct mon_msg.* from mon_msg;
2. insert into mon_msg select * from mon_msg2;
OK, mon_msg has no duplicated data now !
后来发现上述不好用啊。 distinct要求所有列一样才算重复,那主键就是不一样啊,怎么破。有了,选取一个特征列group by。
insert into mon_msg2 select * from mon_msg group by msgid;
insert into mon_msg select * from mon_msg2 group by msgid;