Question about deleting table duplicates
Date: Thu, 18 Sep 2003 12:07:17 -0500
Message-ID: <pOKdnbFXV7ane_SiU-KYvQ_at_giganews.com>
I was looking for thw SQL to delete dupes from a table, and came across
this. All who saw it agreed in principle, but I can't quite figure out the
logic. If we are deleting all rows whose rowid is greater than the least of
the rowids returned from creating the subset of dupes, couldn't we
inadvertently delete some non-dupes rows that were created after the last
dupe ? I mean, any row created after the last dupe would have a greater
rowid, wouldn't it ?
Here's the SQL:
delete from table_1 a
(select min(b.rowid)
where a.rowid >
where b.col_dup_values = a.col_dup_values)
By the way, should the delete ALL dupes, including the originals ? That is all rows participating in duplicity, as it is, will be gone.
Thanks,
Scott
Received on Thu Sep 18 2003 - 19:07:17 CEST