Subject Re: [ib-support] Help with duplicated data
Author Ann W. Harrison
At 03:45 PM 6/22/2001 +0000, Orlando Jimenez wrote:

>I have the following table
>
>Client (
> AccNew Varchar(255),
> AccOld Varchar(255),
> Inst LONGTEXT,
> name Varchar(255));
>
>(*LONGTEXT, I use this data type in BDE with delphi)
>
>This table don't have index neither primary key, of course I have a
>duplicity in the data of this table.
>
>I need a way to remove the duplicated data considering the field
>AccNew my primary key(I want one record by AccNew)

Something like this should work:

delete from client c where exists
(select 1 from client o
where o.AccNew = c.AccNews
and o.AccOld = c.AccOld
and o.Inst = c.Inst
and o.Name = c.Name
and o.rdb$db_key < c.rdb$db_key);



Regards,

Ann
www.ibphoenix.com
We have answers.