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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Puzzle ...

Re: SQL Puzzle ...

From: <mjain_at_my-dejanews.com>
Date: Mon, 16 Nov 1998 11:08:37 GMT
Message-ID: <72p13l$4vp$1@nnrp1.dejanews.com>

Raghu,

Suppose you have a table named Table_A
with three columns named as:

Col_1, Col_2 and Col_3 respectively.

Then you can use following query to delete duplicate rows from the table Table_A:-

DELETE FROM Table_A A
WHERE A.rowid > ( SELECT MIN (B.rowid)

                    FROM Table_A B
                   WHERE B.Col_1  = A.Col_1
                   AND   B.Col_2  = A.Col_2
                   AND   B.Col_3  = B.Col_3 );

Hoope this helps,

Let me know if it worked for you, thanks!!

Manoj Jain
Oracle Certified Professional - OCP DBA Chauncey Certified Oracle7 DBA

16-November-1998

In article <364F9289.1629E71B_at_india.hp.com>,   "K. Raghuraman" <kraghu_at_india.hp.com> wrote:
> Hi,
>
> I have a table with three columns and no keys defined. I want to
> eliminate only the duplicate records from the table in a single SQL
> delete statement. How do I construct my SQL statement ?
>
> Thanks and Regards,
>
> Raghu
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Nov 16 1998 - 05:08:37 CST

Original text of this message

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