Hai ,

> WHERE Product.CategoryID = Category.CategoryID  ?

This is good way .As cfloop will take little more time to execute the  and
not suggestive to do so.


Nagaraj


----- Original Message -----
From: "Chad Gray" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, October 01, 2001 8:05 PM
Subject: SQL question about related tables


> Im wondering what is the best way to get related data from two
> tables.  This would be the MySQL database structure:
>
> Table Name: Category
> CategoryID  (autonumber)
> CategoryName (text)
>
> Table Name: Subcategory
> SubcategoryID (autonumber)
> SubcategoryName (text)
>
> Table Name: Product
> ProductID (autonumber)
> CategoryID (linked to category table)
> SubcategoryID (linked to subcategory table)
> ProductSKU (text)
>
>
> If i know the ProductID, what is the BEST way to get the CategoryName, and
> SubcategoryName?
>
> Two Querys (one in a CFLOOP) ?
> Query inside of a Query   ?
> INNER JOIN   ?
> WHERE Product.CategoryID = Category.CategoryID  ?
>
> Thanks In advanced,
> Chad
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
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