Re: Querying two tables
| From: | Lars Olsson | Date: | Sun, 15 Dec 2002 10:03:33 +0000 |
| Subject: | Re: Querying two tables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128323@lists.php.net to get a copy of this message | ||
Hi!
To fetch information from several tables you usually use a join operation. Here's a starting point in the MySQL manual.
http://www.mysql.com/doc/en/JOIN.html
/Lars (lasso@lassoweb.nu)
Cesar Aracena wrote:
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. Cesar L. Aracena icaam@icaam.com.ar caracena@infovia.com.ar (0299) 156-356688 Neuquén (8300) Capital Argentina