title: SQL Group by & Max
body: <p>I have a following data in a table:</p>
  
  <pre><code>id  name    alarmId  alarmUnit  alarmLevel
  
  1   test    voltage  psu        warning
  2   test    voltage  psu        ceasing
  3   test    voltage  psu        warning
  4   test    temp     rcc        warning
  5   test    temp     rcc        ceasing
  </code></pre>
  
  <p>I'd like to show only the most recent information about every colums group (alarmId,alarmUnit), so the result should look like this:</p>
  
  <pre><code>3   test    voltage  psu        warning
  5   test    temp     rcc        ceasing
  </code></pre>
  
  <p>I've tried so far:</p>
  
  <p><code>SELECT MAX(id) as id,name,alarmId,alarmUnit,alarmLevel  GROUP BY alarmId,alarmUnit;</code></p>
  
  <p>Selected IDs seem to be fine but selected rows aren't corresponding to them. Could you help me?</p>