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: Mario Christ <mario.christ_at_gmx.net>
Date: 6 Apr 2002 07:40:05 -0800
Message-ID: <ca4deda8.0204060740.195ebcde@posting.google.com>


Hi,

thank you. Yes, I mean 'column', not 'row'. However, the result I wanted to get was
A
B
C
B
and not
A
B
C
(which can easily be achieved by using 'dinstinct').

best regards
mario, berlin

Galen Boyer <galenboyer_at_hotpop.com> wrote in message news:<uhemysfd4.fsf_at_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>
Received on Sat Apr 06 2002 - 09:40:05 CST

Original text of this message

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