[PHP-DB] Querying two tables

2002-12-14 Thread Cesar Aracena
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

Re: [PHP-DB] Querying two tables

2002-12-14 Thread Marco Tabini
Hello Cesar-- Your database design is not normalized, so you're going to have to cheat a bit--try this (I'm doing it from memory, so it might not work on the first try): select distinct Relationships.Subcatid, Subcategories.* from Relationships Inner Join Subcategories On Catid = '0001' and Relat