Re: code help!
| From: | Cobra Commander | Date: | Tue, 05 Sep 2000 15:11:57 +0000 |
| Subject: | Re: code help! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15307@lists.php.net to get a copy of this message | ||
I assume this is a DB.
Select * from TABLENAME where ZIPCODE = 'ZIPCODE'
Then you can run a loop and do the sum OR (my MYSQL is limited):
there maybe something like:
Select sum(sales) as SALESSUM from TABLENAME where ZIPCODE = 'ZIPCODE'
something to that effect will give you a single field with the sum oyu are
looking for.
--
----------
The secret Cobra Base - http://cobracommand.net
"Michael Roark" <rhuian@mail.greycouncil.org> wrote in message
news:Pine.BSF.4.21.0009050949530.29687-100000@mail.greycouncil.org...
> Here's what I need to do:
>
> I've got a demographic, one field is a zip code field and there can be
> many entries for the same zipcode. I want to select all the info for like
> zipcodes and then sum the totals (say sales field) for each zip code and
> then list the top 5 zip codes.
>
> If someone could help me out with this one it would be much appriciated.
>
> Thanks,
>
> Michael
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>