--查找姓名、性别、年龄、地址、电话相同的员工记录。
select count(id) as id_count,
name,
sex,
birthday,
address,
tel
from staff
group by
name,
sex,
birthday,
address,
tel
having(count(*) > 1);
--删除姓名、性别、年龄、地址、电话相同的重复员工记录(保留ID最大的一条)。
delete staff where id not in (select max(id) from staff group by name, sex, birthday, address, tel);
原文:http://www.cnblogs.com/ego/p/3700995.html