Re: [SQL] SQL moving window averages/statistics

2009-10-01 Thread Andreas
Just 3 points ... 1) don't use "date" as a column name because it's a data type. 2) to_char(current_date, 'MM')||to_char(current_date, 'DD') is equivalent to to_char(current_date, 'MMDD') 3) you should get the same result with ... where icao='KSFO' and (EXTRACT (MONTH from d

[SQL] SQL moving window averages/statistics

2009-09-23 Thread Kai Carter
Hi there, I'm currently have an sql statement that selects a week of descriptive statistics for various historical weather variables, sorted by date. SELECT to_char(date, 'MM')||to_char(date, 'DD') as date, max(tmax) as max_tmax, min(tmax) as min_tmax, avg(tmax) as mean_tmax, stddev(tmax)