Oracle删除重复的数据,Oracle数据去重复

Oracle删除重复的数据,Oracle数据去重复,第1张

Oracle删除重复的数据,Oracle数据去重复

Oracle  数据库中查询重复数据:

select * from employee group by emp_name having count (*)>1;

 Oracle  查询可以删除的重复数据

select t1.* from employee t1 where (t1.emp_name) in (SELECT t2.emp_name from employee t2 group by emp_name having count (*)>1) and t1.emp_id not in (select min(t3.emp_id) from employee t3 group by emp_name having count (*)>1);

Oracle 删除重复数据

delete from employee t1 where (t1.emp_name) in (SELECT t2.emp_name from employee t2 group by emp_name having count (*)>1) and t1.emp_id not in (select min(t3.emp_id) from employee t3 group by emp_name having count (*)>1);

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/893026.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-14
下一篇 2022-05-14

发表评论

登录后才能评论

评论列表(0条)

保存