Subject | Re: [firebird-support] deleting duplicate records |
---|---|
Author | David Zvekic |
Post date | 2003-08-29T20:59:33Z |
Dixon Epperson wrote:
the unwanted duplicate row, and a "wanted" duplicate row.
By definition, they are both the same row.
What is it that you are trying to accomplish with having the same data in a table
multiple times?
(there are ways to accomplish virtually anything you could have accomplished with duplicate rows,
without actually having any duplicate rows.)
David Zvekic
PS: failing that you use use RDB$DB_KEY to differentiate the rows, but it would be better if you pretend I
didn't say that. RDB$DB_KEY is not guaranteed to be consistant accross transactions. And not guaranteed
to be portable to future implementations.
> The table I am working with cannot have any restraints or key fieldsIf you have 2 rows which are identical, how can you tell the difference between
> because there are times when a duplicate record may be desired. I
> know I could put an index number on each record and get rid of
> unwanted duplicates that way but is there a way to do something like
> this?
>
> DELETE FROM TABLE WHERE $RDB_RECNUMBER=(SELECT $RDB_RECNUMBER FROM
> TABLE WHERE IDNUM=:id AND STCKNUM=:stknum AND QTY=:qt)
>
> Dixon Epperson
>
>
the unwanted duplicate row, and a "wanted" duplicate row.
By definition, they are both the same row.
What is it that you are trying to accomplish with having the same data in a table
multiple times?
(there are ways to accomplish virtually anything you could have accomplished with duplicate rows,
without actually having any duplicate rows.)
David Zvekic
PS: failing that you use use RDB$DB_KEY to differentiate the rows, but it would be better if you pretend I
didn't say that. RDB$DB_KEY is not guaranteed to be consistant accross transactions. And not guaranteed
to be portable to future implementations.