Subject | Re:delete duplicate row |
---|---|
Author | Paul R. Gardner |
Post date | 2006-12-12T20:33:33Z |
Here's a fairly easy way to eliminate all duplicate records for a table:
Let TABLE be the table in question, and A and B be aliases. This
example uses 2 fields, but you'd need to add all of them. This would
remove anything where an exact duplicate was found, but would leave one
copy there.
delete from table a where exists
(select 1 from table b where b.field1 = a.field1 and b.field2 =
a.field2 and b.rdb$db_key > a.rdb$db_key);
[Non-text portions of this message have been removed]
Let TABLE be the table in question, and A and B be aliases. This
example uses 2 fields, but you'd need to add all of them. This would
remove anything where an exact duplicate was found, but would leave one
copy there.
delete from table a where exists
(select 1 from table b where b.field1 = a.field1 and b.field2 =
a.field2 and b.rdb$db_key > a.rdb$db_key);
[Non-text portions of this message have been removed]