title: PostgreSQL select daily max and corresponding hour of ocurrence
body: <p>I have the following table structure, with daily-hourly data:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>How do i select the <strong>DAILY max and THE HOUR in which this max occur</strong>?
  I've tried </p>
  
  <pre><code>SELECT date_trunc('hour', time_of_ocurrence) as hora,
  MAX(particles)
  from my_table WHERE time_of_ocurrence &gt; '2013-09-01'
  GROUP BY hora ORDER BY hora
  </code></pre>
  
  <p>But it doesn't work:</p>
  
  <pre><code>"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
  </code></pre>
  
  <p>My result would be in this format instead (one max per day, showing the hour)</p>
  
  <pre><code>"2013-09-01 05:00:00";100.35
  "2013-09-02 03:30:00";80.13
  </code></pre>
  
  <p>How can i do that? Thanks!</p>