2014-02-06 96 views
0

我目前有一個查詢,它返回表格中的日期時間和值。Postgres:每分鐘數據的總計平均數

Select time, value from table; 

2014-02-05 15:49:54.458 70 
2014-02-05 15:49:55.46 70 
2014-02-05 15:49:56.483 70 
2014-02-05 15:49:57.487 70 
2014-02-05 15:49:58.503 70 
2014-02-05 15:50:00.042 70 
2014-02-05 15:50:01.546 70 
2014-02-05 15:50:03.056 70 
2014-02-05 15:50:04.093 70 

我所希望做的是一樣的東西

select average(value) from table group by (cast time to min resolution)time; 

2014-02-05 15:49 70 
2014-02-05 15:50 70 

回答