Re: [GENERAL] Moving avg using SQL

2009-09-04 Thread Jeff Davis
On Fri, 2009-09-04 at 08:03 +0200, A. Kretschmer wrote: > Which version do you have? Since 8.4 we have CTE aka windowing > functions, a simple axample: Minor terminology correction: CTE stands for Common Table Expression, i.e. WITH [RECURSIVE]. Regards, Jeff Davis -- Sent via pgsql-ge

Re: [GENERAL] Moving avg using SQL

2009-09-03 Thread A. Kretschmer
In response to ? : > How can I do a moving avg by only using SQL? Which version do you have? Since 8.4 we have CTE aka windowing functions, a simple axample: test=*# select n, last_value(n) over mywin , avg(n) over mywin from generate_series(1,20) n window mywin as (partition by (n-1)/

[GENERAL] Moving avg using SQL

2009-09-03 Thread 纪晓曦
How can I do a moving avg by only using SQL?