当前位置:Gxlcms > 数据库问题 > ORACLE查询删除重复记录三种方法

ORACLE查询删除重复记录三种方法

时间:2021-07-01 10:21:17 帮助过:42人阅读

代码如下: select identity(int,1,1) as autoID, * into #Tmp from tableName
select min(autoID) as autoID into #Tmp2 from #Tmp group by Name,autoID
select * from #Tmp where autoID in(select autoID from #tmp2)

最后一个select即得到了Name,Address不重复的结果集(但多了一个autoID字段,实际写时可以写在select子句中省去此列)

(四)

查询重复

代码如下: select * from tablename where id in (
    select id from tablename
    group by id
    having count(id) > 1
)

ORACLE查询删除重复记录三种方法

标签:oid   删除   查询   drop   person   where   copy   deb   操作方法   

人气教程排行