Reply to making this query run faster?

Your name:

Reply:


Posted by news@celticbear.com on 08/24/07 21:19

Hello,
The following brief script takes 35 seconds to run.
If there something I might be able to do to make it run faster?
Thanks for any suggestions!
-Liam

$sql = "SELECT affiliates.accountid AS theaccount, count(ordernum) AS
thecount
FROM orders
JOIN affiliates ON (affiliates.accountid = orders.accountid)
WHERE complete = '1' AND date > '2007-07-01' AND
affiliates.accountid <> 'NULL'
GROUP BY theaccount
ORDER BY thecount desc
LIMIT 10";

$result = @mysql_query($sql);

while ($row1 = mysql_fetch_array($result)) {
$theaccount = $row1['theaccount'];
$thecount = $row1['thecount'];

$arr_msg1[] = "$theaccount : $thecount<br/>";
$arr_msg2[] = "$theaccount : $thecount<br/>";
}

foreach ($arr_msg1 as $arr_msg1) {
echo "$arr_msg1";
}

echo "<br/><br/>";

shuffle($arr_msg2);

foreach ($arr_msg2 as $arr_msg2) {
echo "$arr_msg2";
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация