hello!
I'm processing a loop of records and want to get the total sum of a particular column for all of the records.
I want the total to be allocated to $total_asked.
The column I'm after is "asked".
The following code isn't working for me... where it should return a total of 75 the result I'm getting is 556538336.
my $cond = GT::SQL::Condition->new(
question_id_fk => '=' => "$_->{'question_id'}"
);
$total_asked += $db->select('SUM(asked)', $cond );
...
Can anyone help?
Thanks
r
edit: just corrected the code
I'm processing a loop of records and want to get the total sum of a particular column for all of the records.
I want the total to be allocated to $total_asked.
The column I'm after is "asked".
The following code isn't working for me... where it should return a total of 75 the result I'm getting is 556538336.
Code:
for each of my records... my $cond = GT::SQL::Condition->new(
question_id_fk => '=' => "$_->{'question_id'}"
);
$total_asked += $db->select('SUM(asked)', $cond );
...
Can anyone help?
Thanks
r
edit: just corrected the code