Gossamer Forum
Quote Reply
SELECT SUM() - help
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.

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

Last edited by:

ryel01: Aug 20, 2004, 1:27 AM
Subject Author Views Date
Thread SELECT SUM() - help ryel01 1944 Aug 20, 2004, 1:16 AM
Thread Re: [ryel01] SELECT SUM() - help
ryel01 1883 Aug 20, 2004, 3:22 AM
Thread Re: [ryel01] SELECT SUM() - help
Andy 1879 Aug 20, 2004, 3:25 AM
Post Re: [Andy] SELECT SUM() - help
ryel01 1871 Aug 20, 2004, 3:30 AM