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
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
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
[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