一个bug导致的一张日志表出现大量重复数据,需要删除重复数据,神仙sql如下,sql过于复杂把navicate的sql美化器都给整不会了,美化不出来,执行结果这条sql删除了75万条数据:
DELETE
FROM
t_vk_goods_product_change
WHERE
id IN (
SELECT
id
FROM
(
SELECT id from t_vk_goods_product_change WHERE id NOT IN (
SELECT MIN( id ) as id FROM t_vk_goods_product_change GROUP BY product_code, change_type_name, change_desc
)
) AS a
)
标签:product,vk,删除,重复,sql,SELECT,mysql,id,change
From: https://www.cnblogs.com/gltt/p/17026606.html