Re: Getting total quantities

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

 



*Hai Chris
 I already send him the right one. But my mail has been blocked by the php
lists. so i send a personal mail for him...
FYI....
SELECT SUM(ProductStock) FROM products;
*
if u want to give an other name for the row then use it as *


**
SELECT SUM(ProductStock) as stock FROM products;*

Chaitanya

"A man can get discouraged many times but he is not a failure until he stops
trying..."



On Mon, Feb 15, 2010 at 11:02 AM, Chris <dmagick@xxxxxxxxx> wrote:

> Karl DeSaulniers wrote:
>
>> Would it be?
>>
>> $q = "SUM(ProductStock) FROM products";
>>
>> or
>>
>> $q = "SELECT SUM(ProductStock) AS ProductStock FROM products";
>>
>> if I want to return $ProductStock as the value?
>>
>
> This one.
>
> The "AS" gives it an alias (or shortcut) to make it easier to find in
> mysql_fetch_array etc.
>
>
> --
> Postgresql & php tutorials
>
>
>

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

  Powered by Linux