码迷,mamicode.com
首页 > 其他好文 > 详细

删除表中的重复记录

时间:2019-02-10 20:15:13      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:select   name   HERE   记录   span   nbsp   people   delete   weight   

DELETE
FROM
    people
WHERE
    peopleName IN (
        SELECT
            peopleName
        FROM
            people
        GROUP BY
            peopleName
        HAVING
            count(peopleName) > 1
    )
AND peopleId NOT IN (
    SELECT
        min(peopleId)
    FROM
        people
    GROUP BY
        peopleName
    HAVING
        count(peopleName) > 1
)

 

删除表中的重复记录

标签:select   name   HERE   记录   span   nbsp   people   delete   weight   

原文地址:https://www.cnblogs.com/naixin007/p/10360106.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!