bigelz1215
asked on
removal of duplicate records in a table in an informix 6 database
i am using an informix 6 database.
I have a tabl;e which unfortunately has been updated twice with the same records.
How can I remove the duplicate set of record uing sql, the records are identical - I thought that perhaps use of the rowid may be the answer - can you help
I have a tabl;e which unfortunately has been updated twice with the same records.
How can I remove the duplicate set of record uing sql, the records are identical - I thought that perhaps use of the rowid may be the answer - can you help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And I hate chasing cursors. :(
ASKER
Thanks for the help - I have used your idea with rowids and have come up with a solution which has worked
many thanx
dave
many thanx
dave
Hi bigelz1215,
This is a DB2 forum, so be wary of answers to non-DB2 questions. :)
The solution below won't work on DB2, but it will work on other flavors of SQL. Your mileage may vary....
delete table_a
where rowid not in
(select min(rowid) from table_a
group by column1, column2);
You can also chase a cursor through the data, selecting the duplicates via the cursor and deleting them by the cursor.
Good Luck!
Kent