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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL to find duplicate rows...

RE: SQL to find duplicate rows...

From: Jack C. Applewhite <japplewhite_at_inetprofit.com>
Date: Thu, 06 Dec 2001 14:30:36 -0800
Message-ID: <F001.003D6D3C.20011206133521@fatcity.com>

Jim,

An option that handles multiple duplicates is:

Delete
>From MyTable

Where (MyColumn,RowID) In
(
 Select MyColumn,RowID
 From MyTable
 Minus
 Select MyColumn,Min(RowID)
 From MyTable
 Group By MyColumn
);

You could use Max(RowID) as well, depending on your needs.

Jack



Jack C. Applewhite
Database Administrator/Developer
OCP Oracle8 DBA
iNetProfit, Inc.
Austin, Texas
www.iNetProfit.com
japplewhite_at_inetprofit.com
(512)327-9068

-----Original Message-----
JAMES W [IT/1000]
Sent: Thursday, December 06, 2001 2:26 PM To: Multiple recipients of list ORACLE-L

Hello all,

I know this has come across many times now, and I thought I had it saved somewhere - you know how that goes...

I need to query a table to find all duplicate rows based on a given column. Don't feel like re-inventing the wheel...

Thanks in advance,
Jim

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jack C. Applewhite
  INET: japplewhite_at_inetprofit.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Dec 06 2001 - 16:30:36 CST

Original text of this message

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