DELETE
FROM table表
WHERE
(
table表 字段
) IN (
SELECT FROM(
SELECT
table表 字段
FROM
table表 as 别名
GROUP BY
别名.table表 字段
HAVING
count() > 1
) as c)
AND id NOT IN (
SELECT from(
SELECT
min(id) //最小的记录
FROM
table表 as 别名
GROUP BY
别名.table表 字段
HAVING
count() > 1
)as d )
原文地址:http://blog.51cto.com/kangjunfei/2061539
时间: 2024-10-11 01:31:46