RE: [PHP-DB] Averaging Numbers
| From: | Robert Klinkenberg | Date: | Wed, 15 Aug 2001 17:11:47 +0000 |
| Subject: | RE: [PHP-DB] Averaging Numbers | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11387@lists.php.net to get a copy of this message | ||
You could also do a select sum(counter) from ....
or, if the db supports it, select avg(...) from ...
Saves you the trouble of counting.
Robert Klinkenberg
> Van: Andre P. [SMTP:drowser@zoom.co.uk]
> Verzonden: Wednesday, August 15, 2001 6:48 PM
> Aan: jeff@webdesigns1.com
> CC: PHP-DB
> Onderwerp: Re: [PHP-DB] Averaging Numbers
>
> Maybe I am missing the complexity but I would just add them all up as
> you retrieve them (or where you are printing them out) and then when you
> finish the loop divide the total by the number of of number you are
> averaging over have (i.e this would be 15 if you are taking 15 days).
>
>