Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Duplicate records

Re: Duplicate records

From: Greg Kainz <gregkainz_at_home.com>
Date: Sat, 27 Jan 2001 21:45:04 GMT
Message-ID: <AjHc6.123605$ge4.43942039@news2.rdc2.tx.home.com>

or "... where rowid > ... select (min) ... " to save the lowest rowid in the group,
or "where rowid < ... select (max)... " to save the highest rowid...

<derf23456_at_my-deja.com> wrote in message news:94s03g$ltg$1_at_nnrp1.deja.com...
> Isn't this only going to work where there are two (and only two)
> records that are duplicates? (It threre are 3 records the same, the
> min will only choose one record to delete, leaving two that are the
> same).
>
> If I'm correct above, I think changing the 'where rowid in' to 'where
> rowid NOT in' would delete all the duplicates.
>
>
> In article <94qcrp$c85$1_at_news8.svr.pol.co.uk>,
> "Happy" <allan_at_livvy80.freeserve.co.uk> wrote:
> > delete from table_name
> > where rowid in
> > (select min(rowid) from table_name
> > group by col1, col2, coln
> > having count(0) > 1)
> >
> > Cheers
> > Allan
> >
> > "Screamer" <mflopes_at_bigfoot.com> wrote in message
> > news:94q1l9$ejm$1_at_venus.telepac.pt...
> > > Can someone post a piece of SQL that deletes duplicate records in a
 table,
> > > please ?
> > >
> > >
> >
> >
>
>
> Sent via Deja.com
> http://www.deja.com/
Received on Sat Jan 27 2001 - 15:45:04 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US