Subject Re: this works, but is it the best way?
Author Dixon Epperson
As always, Helen, Thanks! But I'm trying to understand. . .
Here is my original query
> >
> >SELECT s.SD_GTLINENO, s.SD_INVOICE, s.SD_GTID, s1.SD_GTID FROM
> >SALESDATA s, SALESDATA s1
> >WHERE s.SD_GTID != s1.SD_GTID
> >AND s1.SD_INVOICE=s.SD_INVOICE
> >

Here is your assessment. . .
> Now, currently your query is going to return duplicated output rows if
> there are three or more SD_GTID rows associated with the same
> SD_INVOICE.

Do you mean if there had been 3 or more "different" SD_GTID or
was I not even querying for different??

And why 3?
Do you mean that the following scenario would not have shown in the
results
invoice=1400; id=1001
invoice=1400; id=1002

but if I had added a third one
invoice=1400; id=1003
then they all would have shown?

I'm really exasperated at myself for not understanding, but I look at
what your saying and I feel like Charlie Brown.

E. D. Epperson Jr.