hello,
maybe there is another solution that should be quicker, because it uses fewer DB query.
I don't have a clear view what you want from this query, so if you can give me a short
description about it
it would be appriciated. I think this one does the same job:
INSERT INTO galaxy
SELECT
cluster AS gcluster,
sum(size) as gsize,
sum(score) as gscore,
galaxy AS ggalaxy
FROM universe
WHERE cluster BETWEEN 1 AND 200 AND galaxy BETWEEN 1 AND 26
GROUP BY cluster, galaxy;
----- Original Message -----
From: "Michael Roark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 6. 05:27
Subject: [PHP] quicker query?
Is there a faster (better) way to do the following:
if ($result) {
for ($cluster=1;$cluster<200;$cluster++) {
for($galaxy=1;$galaxy<26;$galaxy++) {
$sql="insert into galaxy select avg(cluster) as gcluster,sum(size) as gsize,sum(score)
as gscore,avg(galaxy) as ggalaxy from universe where cluster='$cluster' and
galaxy='$galaxy'";
$result=db_query($sql);
Thanks
Michael
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]