Re: quicker query?

From: Date: Sun, 06 May 2001 11:51:38 +0000
Subject: Re: quicker query?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51606@lists.php.net to get a copy of this message
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" <rhuian@noxordo.com> To: <php-general@lists.php.net> 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

« previous php.general (#51606) next »