[EMAIL PROTECTED] (Cesar Aracena) wrote in news:005801c2a3c6$8ac4f190
$4200a8c0@NOTEBOOK:

And the subcategories are related to categories with the Relationships 
table?

If that's the case:
SELECT * FROM Relationships WHERE CatId = '1'

And if you want the names.
SELECT * FROM Subcategories as sc, Relationships as r
WHERE r.CatId = 'minumber' and r.SubCatId = sc.subcatid


> Hi all,
> 
> I have several tables from which I have to fetch certain products &
> categories based on customer selection. The tables are as follows:
> 
> Table 1 - Categories
> catid (autonum)
> catname
> 
> Table 2 - Sub categories
> subcatid (autonum)
> subcatname
> 
> Table 3 - Products
> prodid (autonum)
> prodname
> 
> Table 4 - Relationships
> Catid
> Subcatid
> Prodid
> 
> Now, the question is how to fetch all the sub-categories let's say that
> are related to category 0001. I know it's as simple as relating two
> tables in one query, but I don't remember how. Any help appreciated.
> 


-- 
*** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to