Oracle 删除根据id 删除重复数据

前端之家收集整理的这篇文章主要介绍了Oracle 删除根据id 删除重复数据前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

查询重复的数据

select * from T_FAYUAN_SXZXRMD a where (a.id) in (select id from T_FAYUAN_SXZXRMD group by id having count(*) > 1)

删除重复的数据

delete from t_CREDITNODE a

where (a.Id) in (select Id from t_CREDITNODE group by Id having count(*) > 1) and rowid not in (select select * from T_FAYUAN_SXZXRMD a where (a.id) in (select id from T_FAYUAN_SXZXRMD group by id having count(*) > 1)min(rowid) from t_CREDITNODE group by Id having count(*) > 1)

猜你在找的Oracle相关文章