Originally posted by ronnie Nope there is no primary key.
How do you know you have duplicates, then?
select account_id, trade_date, settlement_date, amount, quantity
from trades
group by account_id, trade_date, settlement_date, amount, quantity
having count(*) > 1
Using the exact query you specified, I would create a temporary table of all my unique combinations. Then, I would figure out which row I want to drop with a min/max function and put that in the temporary table too. Once I knew the rows I wanted to delete, I would delete them from my base table.
Originally posted by marist89 Oh, so you do have a PK.
Using the exact query you specified, I would create a temporary table of all my unique combinations. Then, I would figure out which row I want to drop with a min/max function and put that in the temporary table too. Once I knew the rows I wanted to delete, I would delete them from my base table.
Jeff,
i dont have a PK on the table at all. It can have multiple records with the same account Id .
could you not create a table as select distinct (*) from original table and then either
a) drop the original table and rename the new one (is this possible)?
or
b) truncate the original tables and populate it from the new table.
Bookmarks