Re: Adding up the RESULT
| From: | Joel Colombo | Date: | Wed, 17 Apr 2002 17:35:24 +0000 |
| Subject: | Re: Adding up the RESULT | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18611@lists.php.net to get a copy of this message | ||
ok.... i thought the SUM only worked with GROUP BY
shit...
that makes me feel stupid.... but smarter now
thanx
Joel
"Jason Wong" <phplist@gremlins.com.hk> wrote in message
news:php.db-18609@news.php.net...
> On Thursday 18 April 2002 00:08, Joel Colombo wrote:
> > i was wondering about a PHP function like mysql_fetch_array
> > but that would select all the ROW values of one FIELD
> > rather the "mysql_fetch_array" selecting all FIELDS of ONE row.
> >
> > does PHP have that function ?
>
> Not yet.
>
> > basically y do i need that ?
>
> You don't :)
>
> > because i am selecting a number of rows from my table from 1 to 35000 at
a
> > time
> > i need the SUM of one field based on the ROWS selected....
> > but... no GROUP BY because the table has 2 fields: index, and fieldname
>
> Why not do it in the database?
>
> SELECT SUM(price) FROM products;
>
> > i have also posted this question in mailing.database.mysql but the
traffic
> > in that group has been too light...
> > and posted to alt.php.sql but i will take any suggestions from any group
on
> > this one...
>
> How about the MySQL mailing list?
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
>
> /*
> "MSDOS didn't get as bad as it is overnight -- it took over ten years
> of careful development."
> (By dmeggins@aix1.uottawa.ca)
> */