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: simple PL/SQL Question: deleting repeated rows

Re: simple PL/SQL Question: deleting repeated rows

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 29 Mar 2002 22:04:14 -0600
Message-ID: <uhemysfd4.fsf@rcn.com>


On 27 Mar 2002, mario.christ_at_gmx.net wrote:
> Hi,
>
> I am just starting with PL/SQL. Maybe someone can help solving a very
> simple problem.
>
> suppose you have the following table (one row only):

I assume you mean column?

> ROW1
> A
> B
> B
> C
> B
>
> how do I delete the repetitions? The table I want to get would be:
> ROW1
> A
> B
> C
> B

        SQL> [19840][17][40][gboyer_at_A4PD]
        SQL> select * from t1;

        FLD1
        ----------
        A
        B
        B
        C
        B

        [19840][17][40][gboyer_at_A4PD]
        SQL> delete t1 t1 where rowid not in (select min(rowid) from t1 t where t1.fld1 = t.fld1);

        2 rows deleted.

        [19840][17][40][gboyer_at_A4PD]
        SQL> select * from t1;

        FLD1
        ----------
        A
        B
        C

        [19840][17][40][gboyer_at_A4PD]
        SQL>

-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
Received on Fri Mar 29 2002 - 22:04:14 CST

Original text of this message

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