Subject | Re: SQL query |
---|---|
Author | Peter Miglinski |
Post date | 2003-05-07T12:20:03Z |
--- In ib-support@yahoogroups.com, Svein Erling Tysvaer
<svein.erling.tysvaer@k...> wrote:
copied.
You can try sg like this if exec time is not critical:
select (or delete) from MyTable t1
where not singular(select * from MyTable t2
where t2.KeyValue=t1.KeyValue)
or maybe
select (or delete) from MyTable T1
where exists(select 'a' from MyTable T2 where T2.NewKey=T1.NewKey
and T2.PrimKey>T1.PrimKey)
Good Luck
<svein.erling.tysvaer@k...> wrote:
> ....course, you do
>
> INSERT INTO NewTable
> SELECT * FROM OldTable
>
> That should prevent duplicate values from being assigned (of
> not know which of the duplicate records are inserted).I think exception is raised in such situation, so none of records are
copied.
You can try sg like this if exec time is not critical:
select (or delete) from MyTable t1
where not singular(select * from MyTable t2
where t2.KeyValue=t1.KeyValue)
or maybe
select (or delete) from MyTable T1
where exists(select 'a' from MyTable T2 where T2.NewKey=T1.NewKey
and T2.PrimKey>T1.PrimKey)
Good Luck