DELETE FROM [table_name]
WHERE [column_name] IN (
select [column_name] from (
SELECT [column_name] FROM [table_name] GROUP BY [column_name] HAVING count([column_name]) > 1
) a
)
AND id NOT IN (
select minid from (
SELECT min(id) as minid FROM [table_name] GROUP BY [column_name] HAVING count([column_name]) > 1) b
)
网友评论