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: Removing duplicate rows from a table !

RE: Removing duplicate rows from a table !

From: <Govind.Arumugam_at_alltel.com>
Date: Thu, 16 Oct 2003 12:09:32 -0800
Message-ID: <F001.005D3671.20031016120932@fatcity.com>


Assuming that we have duplicate rows ( NOT duplicate keys ), you may try this. I have borrowed this from a friend of mine. We have used it successfully. Each of the columns in the table are included as predicates to confirm that we are deleting only the duplicate rows.

delete from noderelatedreplicationqueue a where rowid < (select max(rowid) from noderelatedreplicationqueue b

                where a.NODENBR = b.NODENBR
                and a.LASTUPDATETS = b.LASTUPDATETS
                and a.NODEABOVENBR = b.NODEABOVENBR
                and a.TRANSACTIONTYPEIND = b.TRANSACTIONTYPEIND
                and a.NODETYPECD = b.NODETYPECD
                and a.NODEABOVETYPECD = b.NODEABOVETYPECD
                and a.DISTANCENBR = b.DISTANCENBR
                and a.MARKETCD = b.MARKETCD
                and a.TOPLEVELIND = b.TOPLEVELIND
                and a.LOGICALDELETEIND = b.LOGICALDELETEIND
                and a.LASTUPDATENBR = b.LASTUPDATENBR )

Hope this helps.

Govind

-----Original Message-----
Rama, Shreekantha (K.)
Sent: Thursday, October 16, 2003 3:45 PM To: Multiple recipients of list ORACLE-L

Hi,

	I am trying to remove the duplicate rows from a table with the column data..
	I cannot use PK as it's just a sequence number...
	
	I could find all the duplicate rows by grouping the column. but how can i delete only the duplicate ones and retain the original data..

	Any help is gr8 ! ! ! 

Warm Regards
Shreekanth
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Rama, Shreekantha (K.)
  INET: srama2_at_ford.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: <Govind.Arumugam_at_alltel.com
  INET: Govind.Arumugam_at_alltel.com
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Oct 16 2003 - 15:09:32 CDT

Original text of this message

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