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: Remove duplicates again

Re: Remove duplicates again

From: Lo <lo_chomarat_at_hotmail.com>
Date: Thu, 15 Mar 2001 00:22:18 +0100
Message-ID: <98otte$em0$1@vega.worldonline.fr>

if you use the following script, you can remove duplicates. I use it with success.

I find it on www.dbasupport.com

Description:
  Removes duplicate data from a table.

Code:
  to find duplicates:
select (duplicate field names) from table_name group by (list out fields) having
count(*)>1;

example:
select es, msg_id from msg
group by es, msg_id having count(*) > 1;

to delete duplicates:
delete from table a where rowid > (
select min(rowid) from table b where
a.column1 = b.column2);

example:
delete from msg a where rowid > (
select min(rowid) from msg b where
a.es = b.es and
a.msg_id = b.msg_id);

Lo

"xiaomh" <xiaomh_at_hotmail.com> a écrit dans le message news: 98m3us$eh5$1_at_news.gov.on.ca...
> I want to import 100000 entries to my database. Each entry has mutiple
> columns, suppose 10 columns. There are some duplicates in them(sometimes
> according to (column1, column2), sometimes according to (column5,
 column6)).
>
> How can I keep entries imported to database are unique on (column1,
 column2)
> and (column5, column6).
>
> What's the best way to remove them(duplicates)?
>
> Thanks in advance!
>
>
>
>
Received on Wed Mar 14 2001 - 17:22:18 CST

Original text of this message

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