OK all you SQL gurus...

From: Date: Thu, 31 Jan 2002 10:28:42 +0000
Subject: OK all you SQL gurus...
Groups: php.db 
Request: Send a blank email to php-db+get-16343@lists.php.net to get a copy of this message
I'm trying to figure out a way to do a more efficient join on four tables. The main table is products, with the other tables being common options for the products. It's pretty well normalized, but am I doing these joins properly or is there a more efficient way? This looks pretty ugly to me. --------------------------------------------- $q = "SELECT man.name as brand, category.proper as propername, products.* FROM manufacturers as man, products, category, type WHERE products.catid = category.catid AND man.manid = products.manid AND type.type_id = products.type_id AND category.name = '".$category."'"; if (isset($type)) { $q .= " AND type.type = '".$type."'"; } --------------------------------------------- Any suggestions, or am I ok on this? Much thanks, Mike

« previous php.db (#16343) next »