表test1:
+----+------+------+
| id | name | sex |
+----+------+------+
| 1 | aaa | male |
| 2 | bbb | fema |
| 3 | aaa | male |
| 4 | ccc | male |
+----+------+------+
create table test2(select min(id) as id,name,sex from test1 group by `name`);
drop table test1;
alter table test2 rename test1;
------------------------------------------------------------------------------------------------
select * from test1;
+------+------+------+
| id | name | sex |
+------+------+------+
| 1 | aaa | male |
| 2 | bbb | fema |
| 4 | ccc | male |
+------+------+------+