I wrote up a HOWTO on this a while back for a couple of friends. It covers
theory and benefits/losses for the different methods of joining and
subquerying, all in nice normal english.  It might be more useful in the
long run than just telling you the answer straight out.  :)

See:

http://www.rixsoft.com/InfoTech/sql_db1.html
http://www.rixsoft.com/InfoTech/sql_db2.html

HTH,
Rick

-----Original Message-----
From: Eric Dawson [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 11, 2000 3:38 PM
To: [EMAIL PROTECTED]
Subject: SQL Joins


Trying to figure out something simple? In english I want to list all of the
available options, and whether or not that option is related to a specific
item.

Three tables.
Options.
OptionID
OptionTitle

xrOptionItem.
OptionID
ItemID

Items.
ItemID
ItemTitle

Example.
Options. {1,2,3}
xrOptionItem {[1,1],[1,2],[2,3],[4,1],[4,2],[4,3]}
Items. {1,2,3,4}

So Item and applicable options would be:
Item 1 has Options 1,2
Item 2 has Option 3
Item 3 has no options
Item 4 has Options 1,2,3

I want to have an admin interface that lists all availble options

Item 3
[add][remove] Option 1
[add][remove] Option 2
[add][remove] Option 3

I am sure you can do this with one sql stmt, ItemID is passed as a parameter
to the query.

Do I need to use a subquery?

Eric

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to