Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: simple PL/SQL Question: deleting repeated rows
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