DELETE FROM team WHERE id NOT IN (SELECT a.id FROM (SELECT MIN(id) AS id FROM team GROUP BY name ) a)