title: Rows with max value of each group
body: <p>I'm trying to get rows that have max value in each group.</p>
  
  <p>I have this tables</p>
  
  <pre><code>+-------+-----------+--------------+-----------+
  |  nid  |     name  |   crated     | grp_id    |
  +-------+-----------+--------------+-----------+
  |  1    | RAND_NAME |     123      |        11 |
  |  2    | EHllo     |     111      |        11 |
  |  3    | Stop by   |     444      |        11 |
  |  4    | Radr c    |     555      |        11 |
  |  5    | NAE       |     666      |        22 |
  |  6    | ABC       |     1234     |        22 |
  |  7    | RAND      |     123      |        22 |
  |  8    | YELLO     |     444      |        22 |
  |  9    | AAA       |     555      |        33 |
  |  10   | WWW       |     1235     |        33 |
  |  11   | ADF       |     553      |        33 |
  +-------+-----------+--------------+-----------+
  </code></pre>
  
  <p>So, I want this table</p>
  
  <pre><code>+-------+-------------+------------+-----------+
  | nid   |     name    |  created   | grp_id    |
  +-------+-------------+------------+-----------+
  |   3   | Radr c      |   555      |        11 |
  |   6   | ABC         |   1234     |        22 |
  |  10   | WWW         |   1235     |        33 |
  +-------+-------------+------------+-----------+
  </code></pre>
  
  <p>which means I want to grab rows that have the highest created value in each group. The table will be grouped by grp_id. </p>
  
  <p>I was thinking this way:</p>
  
  <pre><code>SELECT nid, name, created, grp_id
     FROM table t
     WHERE t.created = (SELECT MAX(t1.created) FROM table t1)
     GROUP BY grp_id
     ORDER BY grp_id
  </code></pre>
  
  <p>But, it didn't work out. What should I do to get three different rows that have the highest created value in each group?</p>
  
  <p>Thank you for understanding about my poor explanation.</p>