During ETL development we come across duplicate records regularly, in order to maintain the uniqueness we need to remove the duplicates at the same time retain one record so that we do not loose data. I found a simple query for this, here it is.
Delete from
table_name a
where
rowid >
(select min(rowid) from table_name b
where
a.unique_column=b.unique_column
);
Delete from
table_name a
where
rowid >
(select min(rowid) from table_name b
where
a.unique_column=b.unique_column
);
No comments:
Post a Comment