的相應小時,我有以下表結構,日常每小時的數據:PostgreSQL的選擇日常max和ocurrence
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
我的結果會是這種格式,而不是(每天最多一個,顯示小時)
"2013-09-01 05:00:00";100.35
"2013-09-02 03:30:00";80.13
我該怎麼做?謝謝!
謝謝,但這顯示從同一天的幾個'最大'... – Fernando
好吧,我已經試圖修復,在上述編輯。 –
它仍然顯示同一天的價值。我試圖修改它。 – Fernando