Re: solution reqd for summation of vertical columns in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux