[Gambas-user] MySQL, $Query = "SELECT Sum(Column)"

Bruce bbruen at ...2308...
Sat Nov 3 13:26:41 CET 2012


On Sat, 2012-11-03 at 05:07 -0700, abbat wrote:
> 
> Hi,
> 
> How to create request SUM
> 
> $Query = "SELECT Phones"
> $Phone = $Result!Phone  - works
> 
> 
> 
> $Query = "SELECT Sum(Column)"
> 
> $Sum =$Result!" Sum(Column)"  - not works
> $Sum =$Result!Sum(Column)  - not works
> 
> Thanks
> 


Working a bit in the dark here abbat, but 
without an indication of the rdbms, try

$Query = "SELECT Sum(Column) as kangaroos"
$Sum = $Result!kangaroos

or 
$Sum = $Result["kangaroos"]


I doubt that $Result!Sum(Column) could ever work
and I'm pretty sure that no rdbms in the known 
universe would ever succeed with
$Sum =$Result!" Sum(Column)".

In the latter case, think 
$Sum=$Result!a_result_field_that_does_not_exist

In the former case, think
$Sum=$Result!now_I_want_you_to_go_back_and...
_recompute_an_entirely_different_result_field.

:-)
Bruce








More information about the User mailing list