Re: [GENERAL] range intervals in window function frames

2010-12-14 Thread Daniel Popowich
Tom Lane writes: > Daniel Popowich writes: > > Close. Your where clause needed to have (ts<=t1.ts). It can also be > > simplified to this: > > > select t1.ts, t1.value, (select avg(t2.value) > >from sample t2 > >where (t

Re: [GENERAL] range intervals in window function frames

2010-12-14 Thread Tom Lane
Daniel Popowich writes: > Close. Your where clause needed to have (ts<=t1.ts). It can also be > simplified to this: > select t1.ts, t1.value, (select avg(t2.value) >from sample t2 >where (t1.ts - t2.ts) <= interval '5 min

Re: [GENERAL] range intervals in window function frames

2010-12-14 Thread Daniel Popowich
Vincent Veyron writes: > > What I would LIKE to do is this: > > > > select *, avg(ts) over(order by ts range (interval '5 min') preceding) > > from sample order by ts; > > > > This? > > > select t1.ts, t1.value, (select avg(t2.value) from (select value from > sample where (t1.ts-ts

Re: [GENERAL] range intervals in window function frames

2010-12-14 Thread Vincent Veyron
[sent you a personal email by mistake - slightly corrected query posted to the list] Le dimanche 12 décembre 2010 à 10:55 -0500, Daniel Popowich a écrit : > Hello all! > > I need to do moving averages over time series data and was hoping > window functions could solve the problem for me, but it d