Oracle 怎么样抽取、删除重复记录?

栏目:eas cloud知识作者:金蝶来源:金蝶云社区发布:2024-09-22浏览:1

Oracle 怎么样抽取、删除重复记录?

问题描述:

解决方案:

查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断

    select * from people    where peopleId in (select   peopleId from   people group by   peopleId having count(peopleId) > 1)

 如果要删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录

    delete from people
    where peopleId in (select   peopleId from people group by   peopleId   having count(peopleId) > 1)
    and rowid not in (select min(rowid) from   people group by peopleId having count(peopleId )>1)


特别注意:数据删除前请务必做好备份工作,避免误删的情况发生。

Oracle 怎么样抽取、删除重复记录?

问题描述:解决方案:查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 select * from people where people...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息