Subject | Re: [ib-support] need help deleting duplicate rows |
---|---|
Author | Helen Borrie |
Post date | 2001-11-03T04:01:52Z |
Mark,
What I would want to do is create a totally new, temp table with the structure I want, with a unique index over the columns I want to use to enforce uniqueness; then write a stored procedure to select only the rows I want to keep and pump their data into the new table.
Then I'd drop the old table, recreate it and pump the data back from the temp table.
regards,
Helen
At 08:57 PM 02-11-01 -0600, you wrote:
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
What I would want to do is create a totally new, temp table with the structure I want, with a unique index over the columns I want to use to enforce uniqueness; then write a stored procedure to select only the rows I want to keep and pump their data into the new table.
Then I'd drop the old table, recreate it and pump the data back from the temp table.
regards,
Helen
At 08:57 PM 02-11-01 -0600, you wrote:
>hello everyone..All for Open and Open for All
>
>i am new to IB.
>
>as a result of a very large conversion project - we have a Service_fees
>table that has several instances of dupicate rows. originally we thought it
>would be easy to identify and delete the dups - but this has not been the
>case.
>
>we were able to identify them easily enough with the following sql (see
>below) - but deleting them has been more of a challenge.
>
>i have tried writing a delphi program - but we keep getting an exception
>when we try to delete one of the dups. basically the error message from
>delphi is - i was expecting 1 row but i got back multiple rows - which one
>do you really want me to delete.
>
>any help would be greatly appreciated.
>
>thx
>mark
>
>
>CREATE TABLE SERVICE_FEES (
> SERVICE_KEY REQUIRED_LONG,
> FEE_KEY REQUIRED_LONG,
> FEE_AMOUNT MONIES,
> WAIVED CHAR_1,
> FLIGHT_KEY REQUIRED_LONG
>)
>
>CREATE ASCENDING INDEX SERVICE_FEESINDEX1 ON SERVICE_FEES (SERVICE_KEY,
>FLIGHT_KEY)
>
>
>select
> count(*),
> a.service_key,
> a.fee_key,
> b.service_type
>from
> service_fees a,
> services b
>where
> b.service_key = a.service_key
>group by
> a.service_key,
> a.fee_key,
> b.service_type
>having
> count(*) > 1
>
>
>CONFIDENTIALITY NOTICE: The information contained in the transmission is
>considered by TravelCLICK and the sender to be confidential. This material
>is intended only for the use of the recipient(s) named above and may not be
>disclosed to others without express written consent of the sender.
>
>
>[Non-text portions of this message have been removed]
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________