Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a week_value column from the table "vin_temp_table" with the following values.I am using Greenplum database with postgres 8.2 on it.

633
423
389
348
341
326
321
316
301
293
291
1
2

Now I am trying to aggregate the next 13 values from the current column and am trying to put them in an array using the following query but I get the error "array_agg_transfn called in non-aggregate context postgres". Could some one help me out. Thanks!

select a."Week_value", array_agg(a."Week_value") over(order by prod_name,week_date desc rows between 0 preceding and 12 following) 
from vin_temp_table a

So,for example the first row array result contains 13 values including itself until the next 13 column values {633,423, 389, 348, 341, 326, 321, 316, 301, 293, 291 ,1 ,2 }

share|improve this question
    
possible duplicate of Get column values from multiple rows as array –  Erwin Brandstetter Feb 24 '14 at 18:19
    
I answered at your duplicate question: rows between frame_start AND frame_end syntax is just not available in your old version. –  Erwin Brandstetter Feb 24 '14 at 18:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.