Would it be?

$q = "SUM(ProductStock) FROM products";


$q = "SELECT SUM(ProductStock) AS ProductStock FROM products";

if I want to return $ProductStock as the value?


On Feb 14, 2010, at 10:55 PM, Karl DeSaulniers wrote:

Hello List,
I have a situation where I want to figure out the total number of products in my database. I want to read all the fields $ProductStock and add them together to get the TOTAL number of products, not just the number of rows in my database.
Any pointers on the code to use for adding multiple rows field values?


Say I have three individual products and Product one has 10 and Product 2 has 20 and Product three has 5, and these values are set in the field $ProductStock, I want to get the result of 35 and not 3.

Any help is appreciated. TIA

Karl DeSaulniers
Design Drumm

Karl DeSaulniers
Design Drumm

Reply via email to