Re: Querying two tables

From: Date: Sat, 14 Dec 2002 23:21:35 +0000
Subject: Re: Querying two tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-24151@lists.php.net to get a copy of this message
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 Relationships.Subcatid = Subcategories.subcatid Assuming that it works, this is highly inefficient, because the Relationships table should really be split in two or three different tables, so that you would really only manipulate the minimum set of data needed to achieve your goals. Also, please don't cross-post. It clutters the mailing lists and it's bad form. Cheers, Marco -- ------------ php|architect - The Magazine for PHP Professionals The monthly magazine dedicated to the world of PHP programming Check us out on the web at http://www.phparch.com!

« previous php.db (#24151) next »