Mysql-> SQL statement: An SQL statement is used to delete duplicate data in the table. Occasionally, when I talked to my colleagues about this issue, I wrote the code for your reference ~ // Data preparation Mysql code drop table t_user; create table t_user (id int (5) not null auto_increment, username varchar (10), age int (3 ), primary key (id); insert into t_user (username, age) values ('aaa', 20); insert into t_user (username, age) values ('aaa ', 20); insert into t_user (username, age) values ('aaa', 20); insert into t_user (username, age) values ('bbb', 20 ); insert into t_user (username, age) values ('bbb ', 20); insert into t_user (username, age) values ('ccc', 20); insert into t_user (username, age) values ('ccc ', 20); insert into t_user (username, age) values ('ddd', 20); insert into t_user (username, age) values ('ddd ', 20); DELETE statement: Mysql code DELETE t FROM t_user t, (SELECT min (id) AS ttid, username FROM t_user t2 group by t2.username) AS tt WHERE t. id> tt. ttid and t. username = tt. username;