Re: Querying two tables
| From: | Javier | Date: | Sun, 15 Dec 2002 22:49:06 +0000 |
| Subject: | Re: Querying two tables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128352@lists.php.net to get a copy of this message | ||
icaam@icaam.com.ar (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)