List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:July 30 2002 7:53pm
Subject:Re: removing duplicate records
View as plain text  
If the columns are defined as not null, just add a unique index on all 
the fields.
alter table ignore add unique(col1.col2.col#);

walt wrote:

>Does anyone know a good way find and remove duplicate records from a table?
>I can create an identical table structure and use a script to pull records 
>from the existing table and insert them into the new table if they are not 
>duplicates, but I'd rather not do it that way. Here is an example of an sql 
>script  I use for Oracle databases
>
>delete   from employee a
>where    rowid < (
>select  max(rowid)
>from    employee b
>where   b.COL1 = a.COL1
>and     b.COL2 = a.COL2
>and     b.COL# = a.COL#);
>
>sql, query
>
>Thanks in advance!
>


Thread
removing duplicate recordswalt30 Jul
  • Re: removing duplicate recordsGerald Clark30 Jul
RE: removing duplicate recordsDavid Kramer30 Jul
  • Re: removing duplicate recordswalt31 Jul
    • Re: removing duplicate recordsVivian Wang31 Jul
    • RE: removing duplicate recordsGordon31 Jul
  • getting the maximum valuedestr031 Jul
  • Re: getting the maximum valueGerald Clark31 Jul
RE: removing duplicate recordsDavid Kramer31 Jul
RE: getting the maximum valueChris Kay31 Jul