| From: | Dani Castaños <dcastanos(at)androme(dot)es> | 
|---|---|
| To: | <pgsql-sql(at)postgresql(dot)org> | 
| Subject: | SUM Array values query | 
| Date: | 2009-05-18 10:49:16 | 
| Message-ID: | 003f01c9d7a6$4a6d9b90$df48d2b0$@es | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
Hi all,
I've this query including arrays:
SELECT hour[1:5], statistics_date
  FROM statistics_daily
 WHERE statistics_date = to_date( '03/01/2008', 'DD/MM/YYYY' )
Result:
            hour            | statistics_date
----------------------------+-----------------
 {1800,1800,1800,1800,1800} | 2008-01-03
I'm just wondering if there's some way to retrieve the hour column as the
sum of the array values... Just like this:
            hour            | statistics_date
----------------------------+-----------------
 9000                       | 2008-01-03
Hour is a bigint[] array column.
My version of postreSQL is 8.1.9
Thank you in advanced!
P.S.: Sorry if I had send it before, but I think I was not subscribed to the
mailist.
--
Dani Castaños Sánchez
dcastanos(at)androme(dot)es
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2009-05-18 11:10:56 | Re: Extracting data from arrays | 
| Previous Message | Dani Castaños | 2009-05-18 10:45:10 | Extracting data from arrays |