SELECT TR.1_id
FROM TRICK TR
WHERE NOT IN (SELECT 1_id FROM Trick TR2, Trick-Magician-Knows TMK WHERE
TR2.1_id = TMK.1_id)

Is you basic query.  I don't know how and where you are getting the user
inputed data to see which Magician you want to query, but you should get the
basic idea.  I also recommend you rethink those table names.

-----Original Message-----
From: Gonzo Rock [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 09, 2001 1:41 PM
To: CF-Talk
Subject: SQL Question


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.

thanks for any insight !
Gonzo

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to