美文网首页
MySQL删除重复数据

MySQL删除重复数据

作者: 风静花犹落 | 来源:发表于2021-02-25 14:31 被阅读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

相关文章

网友评论

      本文标题:MySQL删除重复数据

      本文链接:https://www.haomeiwen.com/subject/uormwktx.html