私は次のテーブル構造を持っており、毎日毎時データがあります:
time_of_ocurrence(timestamp); particles(numeric)
"2012-11-01 00:30:00";191.3
"2012-11-01 01:30:00";46
...
"2013-01-01 02:30:00";319.6
毎日の最大値とこの最大値が発生する時間を選択するにはどうすればよいですか? 私はもう試した
SELECT date_trunc('hour', time_of_ocurrence) as hora,
MAX(particles)
from my_table WHERE time_of_ocurrence > '2013-09-01'
GROUP BY hora ORDER BY hora
しかし、うまくいきません:
"2013-09-01 00:00:00";34.35
"2013-09-01 01:00:00";33.13
"2013-09-01 02:00:00";33.09
"2013-09-01 03:00:00";28.08
私の結果は代わりにこの形式になります(1日あたり1つの最大値、時間を表示)
"2013-09-01 05:00:00";100.35
"2013-09-02 03:30:00";80.13
どうやってやるの?ありがとう!