Re: solution reqd for summation of vertical columns in PHP
| From: | Niel Archer | Date: | Sun, 14 Sep 2008 19:50:07 +0000 |
| Subject: | Re: solution reqd for summation of vertical columns in PHP | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45402@lists.php.net to get a copy of this message | ||
>
> On Sep 13, 2008, at 10:05 PM, Vaibhav Informatics wrote:
>
> > Please let me know if there is a simple method to total up the
> > column values
> > in Mysql database tables using php as in excel.
>
> I believe what you are looking for is count(fieldname)
COUNT returns the number of rows. I think they're after SUM
SELECT SUM(price) WHERE available = 1;
would total the values in the returned row's price column
--
Niel Archer