title: Select max() of every value mariaDB
body: <p>I have a table that looks like this:</p>
  <pre><code>name  price  class
  a       10     x
  a       20     y
  a       15     z
  b       40     y
  b       35     z
  c       5      x
  c       10     y
  c       15     z
  c       12     w
  </code></pre>
  <p>I want to get for every name which is the highest price and to which class it belongs. something like this:</p>
  <pre><code>name  price  class
   a     20      y
   b     40      y 
   c     15      z
  </code></pre>
  <p>I have tried this:</p>
  <pre><code>SELECT name, max(price), class 
  from t 
  GROUP by name
  </code></pre>
  <p>but it brings me the wrong class. I get this:</p>
  <pre><code>name  price  class
   a     20      x
   b     40      y 
   c     15      x
  </code></pre>
  <p>can you tell me what am I doing wrong?</p>