sum of array elements

From: "Thomas Keller" <kellert(at)ohsu(dot)edu>
To: "Postgresql PDX_Users" <pdxpug(at)postgresql(dot)org>
Subject: sum of array elements
Date: 2008-10-23 18:23:02
Message-ID: 924C5C78-0FAD-4175-B0C7-545096138B59@ohsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

Hi,
Is there an easy way (succinct) to get the sum of values in an array.
E.g.
a260_values is an array of decimal values. And I'd like to get the
average.

Something like Update table SET a260_ave =
SUMARRAY(a260_values[1:3]) / 3

?

thanks,

Tom
kellert(at)ohsu(dot)edu
503-494-2442

Responses

Browse pdxpug by date

  From Date Subject
Next Message Devin Ben-Hur 2008-10-24 05:04:52 Re: sum of array elements
Previous Message Jeff Davis 2008-10-22 16:52:55 Re: 9/18 Visual Planner Meeting Wrapup