Ditto to what the others said, but you also haven't told us if all those
tables will always have matching records - which will make the difference
between using inner joins and outer joins.

I think the main thing that you're not understanding is how to build up the
inner join syntax. Here's an example of a from statement with multiple
tables joined.

FROM ((recipe INNER JOIN (course INNER JOIN recipecourse ON course.courseid=
recipecourse.courseid) ON recipe.recipeid = recipecourse.recipeid)
INNER JOIN (cuisine INNER JOIN recipecuisine ON cuisine.cuisineid =
recipecuisine.cuisineid) ON recipe.recipeid = recipecuisine.recipeid)
INNER JOIN (ingredient INNER JOIN recipeingredient ON
ingredient.ingredientid = recipeingredient.ingredientid) ON recipe.recipeid=
recipeingredient.recipeid

See how they're nested?

This is one area where I think that joining in the where clause instead of
the from clause is easier and less confusing. The same thing could be done
as:

FROM recipe r, recipecourse rc, course c, cuisine cu, recipecuisine rcu,
ingredient i, recipeingredient ri
WHERE r.recipeid = rc.recipeid
AND rc.courseid = c.courseid
AND r.recipeid = rcu.recipeid
AND rcu.cuisineid = cu.cuisineid
AND r.recipeid = ri.recipeid
AND ri.ingredientid = i.ingredientid


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222553
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to