At 18:26 10/11/01, you wrote:
>A SQL Question...
>
>Bear with me... I'm kinda new here.
>
>I am trying to query table1, selecting records that do NOT have a relation
>in a subset from table3 that is related to table2.
>
>
>Example:
>
>table1(Trick table)
> 1_id,trickName,trickDescription
>
>table2(Magician table)
> 2_id,lastName,firstName
>
>table3(Trick-Magician-Knows table)
> 2_id,1_id
>
>if I choose some magician I want a list of tricks he/she DOES-NOT know.
Interesting question! I'm no SQL expert either... I would use something like:
SELECT one_id FROM table1 EXCEPT SELECT one_id FROM table3 WHERE
table3.two_id = table2.two_id AND table2.lastName = '<name of magician to
test for>';
which does generate the correct results, but there are probably more
elegant ways of doing it.
best,
Mo
Mo Holkar
Digital Mind Games -- log on to take over
mo.holkar@digitalmindgames.com
http://www.digitalmindgames.com