美文网首页
删除重复数据并保留一条

删除重复数据并保留一条

作者: S等价交换S | 来源:发表于2021-05-31 14:56 被阅读0次

    delete from employee where objuid in (

    SELECT

    objuid

    FROM

    (

    SELECT

    objuid

    FROM

    employee

    WHERE

    wx_id IN (

    SELECT

    wx_id

    FROM

    employee

    GROUP BY

    wx_id

    HAVING

    count(*) > 1

    )

    AND objuid NOT IN (

    SELECT

    min(objuid)

    FROM

    employee

    GROUP BY

    wx_id

    HAVING

    count(*) > 1

    )

    ORDER BY

    user_name

    ) a)

    相关文章

      网友评论

          本文标题:删除重复数据并保留一条

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