in reply to DBI and fetchall_arrayref (gosh!)
SELECT report_no, reported_by, project_no, to_char(date_reported,'DD-MON-YYYY'), cat1, cat2, cat3 compute avg(cat1), avg(cat2), avg(cat3)
If that doesn't work, try this:
before the first foreach loop:
In the second loop:my @sums;
At the end you have the sum of each column in @sums and just have to divide each sum by $i, which holds the number of rows.$sums[$number] += $element;
|
|---|