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

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...