if you have a primary key, for example id, you can do:
delete from people where id not in ( select minid from (select min(id) as minid from people group by firstname, lastname) as newtable )
the subtitle bit select min(id)... provides you with unique (identifier-based) lines for a given combination of first name, last name; and then you delete all other lines, i.e. your duplicates. You need to wrap your subquery due to an error in mysql, otherwise we could do:
delete from people where id not in ( select min(id) as minid from people group by firstname, lastname )
it would be better:
delete people from people left outer join ( select min(id) as minid from people group by firstname, lastname ) people_grouped on people.first_name = people_grouped.first_name and people.last_name = people_grouped.last_name and people_grouped.id is null
to avoid a subquery.
davek source share