0

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 }

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.