query is returning over 74,000 results and taking 30 seconds - HELP!

From: Date: Mon, 04 Aug 2003 13:48:41 +0000
Subject: query is returning over 74,000 results and taking 30 seconds - HELP!
Groups: php.db 
Request: Send a blank email to php-db+get-29662@lists.php.net to get a copy of this message
Hi Guys, I've tried several different things with the following 2 queries but nothing seem to help. I've stared at the code and reworked it for hours on end and frankly I am getting frustrated. I'm only posting the queries themselves without the PHP code as the entire section is quite long. If someone wants it I'd be more than happy to post it as well. ANY help or guidance is very much appreciated. I'm so far beyond frustrated it isn't funny :-( Thanks in advance. Aaron CODE: $mQuery = db_query("SELECT DISTINCT manufacturer FROM kcs_threads ORDER BY manufacturer"); while ($mResult = db_fetch($mQuery)) { //HTMl here $query = "select t.type, t.newUrlType, g.threadType, g.groupName, g.groupNameUrl FROM kcs_threads t LEFT JOIN kcs_threadgroups g ON t.type = g.threadType WHERE t.manufacturer = ".escapeQuote($mResult['manufacturer'])." ORDER BY t.type, g.groupName"; $result = db_query($query); while($thread = db_fetch($result)) { //If validations and HTML display here } }

« previous php.db (#29662) next »