参考
DELETE FROM studentWHERE 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)
本文共 306 字,大约阅读时间需要 1 分钟。
参考
DELETE FROM studentWHERE 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)
转载于:https://my.oschina.net/airship/blog/476586