title: Select columns by choosing maximum value in multiple columns in SQL
body: <p>Imagine the following exemplary table:</p>
  <pre><code>time      name     value1 value2
  12:00     Hans     2      4
  12:30     Hans     2      4
  13:00     Hans     3      5
  14:00     Peter    4      4
  15:00     Peter    4      4
  </code></pre>
  <p>I want to filter by maximum time stamp and name.</p>
  <p>Meaning I want to get</p>
  <pre><code>13:00     Hans     3      5
  15:00     Peter    4      4
  </code></pre>
  <p>Using <code>select max(time),name,value1,value2 from table group by name</code>
  does not work. It tells me to use an aggregate function or group by on value1 and value2 also.</p>
  <p>If I group by name, value1 and value2 then I get the following result though since value1 and value2 are different for two rows of Hans:</p>
  <pre><code>12:30     Hans     2      4
  13:00     Hans     3      5
  15:00     Peter    4      4
  </code></pre>
  <p>What is the solution?</p>