MySQL删除重复数据

2021-02-25  本文已影响0人  风静花犹落
DELETE school_students_base
FROM
    school_students_base, 
    (
        SELECT
            min(id) id,
            certificates_number
        FROM
            school_students
        GROUP BY
            certificates_number
        HAVING
            count(*) > 1
    ) t2
WHERE
    school_students_base.certificates_number = t2.certificates_number
AND school_students_base.id > t2.id
上一篇 下一篇

猜你喜欢

热点阅读