main logo
Subject: Re: Finding non-matched items
Author: Ruslan Zasukhin
Posted: 2002/08/31 10:34:32
 
View Entire Thread
New Search


on 8/31/02 18:03, Marcus Bointon at marcus .AT. synchromedia .DO.T co.uk wrote:

> Three tables linked through a link table:
>
> A<-B->C
>
> How do get a cursor of the records in A that are NOT linked to C?
>
> This has come up before, but that was before the introduction of outer
> joins. Does it help? Something like:
>
> SELECT a.* FROM a,b WHERE NOT(b.aptr *= a.recID)
>
> Though that just looks plain wrong... ;^)
>
> It strikes me that this would be ideally solved by a sub-select, but we
> don't have them yet. Somehting along the lines of:
>
> SELECT * FROM A WHERE A.recID NOT IN (SELECT b.aptr from A,B WHERE
> b.aptr=a.recID).
>
> Or do I have make 2 cursors and subtract one from the other manually?

Right now YES.

I did not look how this task is solved in SQL 92,
Probably your solution is correct syntax.

But when I think about HOW this query will be resolved by DBMS I see that
there is much more effective way...
In this way It is not needed build join table, then compare to set of IDs.

Hmm, may be it can be put on optimizator...
If no then use own syntax...not very good
Okay, will see.

--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan@paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on .AT. lists .DO.T macserve.net
-------------------------------------------------------------
 
©2002 Ruslan Zasukhin
<-- Prior Message New Search Next Message -->