查询表中相同姓名id最大的数据
1. select a.* from `user` a, (select name ,max(id) as max_id from `user` group by name) b where a.id =b.max_id
2.select * from `user` a where a.id in (select max(id) from `user` group by name)
删除表中姓名相同的数据只保留最大id的数据
delete from `user` where id not in (select a.id from (select max(id) id from `user` group by name) as a)