Quote:
Originally Posted by kahuna
I don't know if this is more efficient, but it seems like a positive approach might be better where there are only a few duplicates.
DELETE FROM tableA A1
WHERE column1 in (SELECT column1 FROM tableA GROUP BY column1 having count(*) > 1)
and rowid != (select min(rowid) from tableA A2 where A1.column1 = A2.column1)
|
Correct me if am wrong !
Am not able to understand the optimization that you have made to make the query run faster.
Basically, with combination of using selected columns ( column1 ) and the specific rowids ( rowid ), what is the need to specify an extra condition with a separate subquery to extract column1.
Isnt that redundant ? Or how does it make the query optimized and more efficient.
This is really equivalent to for each record with a rowid ' x ', necessarily two subqueries should be executed for all the records.