Possible duplicate:
Oracle Delete rows matching multiple values
We have a table in which the same data has been inserted twice as most (but not all) of the rows that appear twice in the table. Simply put, I would like the SQL statement to delete one version of a row while preserving another; I do not mind which version will be removed, as they are identical.
The table structure looks something like this:
FID, unique_ID, COL3, COL4 ....
Unique_ID- This is the primary key, each of which appears only once.
FIDis a key that is unique to each function, so if it appears more than once, duplicates must be deleted.
To select objects with duplicates, follow these steps:
select count(*) from TABLE GROUP by FID
Unfortunately, I cannot figure out how to go from this to the SQL delete statement, which will delete extraneous rows, leaving only one of them.
This question was asked before, and I tried to create a table with excellent, but how can I get all the columns without naming them? This gets only one column FID and lists all the columns that need to be saved:ORA-00936: missing expression
CREATE TABLE secondtable NOLOGGING as select distinct FID from TABLE
source
share