参考 http://www.cnblogs.com/chy1000/archive/2010/03/02/1676282.html
DELETE FROM student WHERE sname IN (SELECT a.sname FROM (SELECT tmp.* FROM student tmp)a GROUP BY a.sname HAVING COUNT(a.sname) > 1) AND sno NOT IN (SELECT MIN(a.sno) FROM (SELECT tmp.* FROM student tmp)a GROUP BY a.sname HAVING COUNT(a.sname)>1)
时间: 2024-11-01 21:57:08