create TEMPORARY table tmp select id from airport WHERE id IN (SELECT id FROM airport GROUP BY code HAVING COUNT(code) > 1) AND id NOT IN (SELECT max(id) FROM airport GROUP BY code HAVING COUNT(code ) >1);
delete from airport where id in (select id from tmp) ok,操作完成,再看看有没有重复的情况:
SELECT id FROM airport GROUP BY code HAVING COUNT(code) > 1