Subject | Re: [firebird-support] this works, but is it the best way? |
---|---|
Author | Helen Borrie |
Post date | 2005-03-01T01:52:23Z |
At 06:04 PM 28/02/2005 +0000, you wrote:
with the other fields. Your index doesn't do anything useful.
a) do you want to simply *find* the duplicate linkages (but don't care
about fixing the integrity problem)
or
b) do you want to know how to avoid getting the duplicate linkages from
happening?
./heLen
>We have a table of invoices, what I am looking for is where anSD_GTLINENO is presumably the primary key. It doesn't need to be involved
>invoice is assigned to two different customer numbers. The separate
>customer numbers might point to the same customer, but by having a
>double entry here, they could get a double rebate.
>
>Right now the table is real small, but it will probably get huge.
>I will limit the scope of the query to a date range, and I do have an
>index on SD_GTLINENO, SD_INVOICE, and SD_GTID and also on the invoice
>date field. (SD_GTLINENO IS a unique identifier.)
>
>Is there a better way to make sure you don't have one invoice pointing
>to separate customer ID?
with the other fields. Your index doesn't do anything useful.
>SELECT s.SD_GTLINENO, s.SD_INVOICE, s.SD_GTID, s1.SD_GTID FROMI'm not clear what you are aiming for with this question --
>SALESDATA s, SALESDATA s1
>WHERE s.SD_GTID != s1.SD_GTID
>AND s1.SD_INVOICE=s.SD_INVOICE
a) do you want to simply *find* the duplicate linkages (but don't care
about fixing the integrity problem)
or
b) do you want to know how to avoid getting the duplicate linkages from
happening?
./heLen