Wednesday, May 2, 2018

Delete Duplicate Rows From Table in Oracle SQL


Solution:


delete from table_name

where rowid not in

(select max(rowid) from table_name group by primary_key);





delete from emp_attn_Data

where rowid not in

(select max(rowid) from emp_attn_Data group by emp_id||at_dt);



select * from emp_attn_Data

where rowid not in

(select max(rowid) from emp_attn_Data group by emp_id||at_dt);


select * from emp_attn_Data

where rowid not in

(select max(rowid) from emp_attn_Data group by emp_id||at_dt) and at_dt between '26-MAY-18' and '25-JUN-18'

order by emp_id


No comments:

Post a Comment

How to install and configure Oracle Apex 24.1 with ORDS 22, Tomcat 9 and Jasper Report 7 on Oracle Linux 8.10

#########################Install Oracle  APEX 24.1################################ ----------------------------------------------------...