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

Home -> Community -> Usenet -> c.d.o.misc -> Re: please help with sql-statement(creation)

Re: please help with sql-statement(creation)

From: Daan Eenkhoorn <daan_at_dsv.nl>
Date: Wed, 9 Sep 1998 10:34:39 +0200
Message-ID: <6t5ehk$37p4$1@ns0.klm.nl>


To resolve the 'BE problem' (Om het BE probleem op te lossen) delete from x a
where string2 not like 'BE%'
and exists
(select 'x' from x b
where b.string1 = a.string1
and string2 like 'BE%')
This subquery says: there is a record with the same 'primary' key and the string2 column starting with BE)

The EDKL issue can be resolved along the same lines

If it really doesn't matter which record is deleted delete from table x
where x.rowid >
(select min(rowid)
from table y
where y.primary key = x.primary key)
Usually applied if for some reason the HELP table is imported more than once due to installation errors. There has never been a proper primary key on the HELP table.
You might want to add the primary key after removing the dups

Hth,

Sybrand Bakker

Steven Cools wrote in message <01bdda4b$b19fe390$74faa8c0_at_steven>...
>I'm quite desperate...Can u help me ?

[sniped]

>I want to eliminate all the duplicate records (I mean I want string1 to be
>unique, not the whole
>record !!!) but here comes the catch: if string2 begins with 'BE' then I
>don't want to delete this record. For example:
>
>Table X (columns: string1, string2, string3)
>===============================
>ABC BE-123 DDD
>ABC CL344 EEE
>DDF BE-123 GGGG
>EDKL DIO LSI
>EDKL OST DIOZ
>
>here I want to delete the duplicate values:
>
>ABC BE 344 EEE (because the other ABC record has BE-xxx as
>string2)
>EDKL DIO LSI or EDKL OST DIOZ (I only
>want to delete 1 of them: which doesn't matter but CERTAINLY NOT BOTH!!!!!)
>Steven_at_digimap.be
>
>
>
>
Received on Wed Sep 09 1998 - 03:34:39 CDT

Original text of this message

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