title: Get row has Max value in MySQL?
body: <p>I want to get <code>staff_id</code> = <code>AZ</code> has MAX(<code>step</code>) value of this table (name: test).</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: center;">id</th>
  <th style="text-align: center;">general_id</th>
  <th style="text-align: center;">staff_id</th>
  <th style="text-align: center;">step</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: center;">1</td>
  <td style="text-align: center;">4</td>
  <td style="text-align: center;">A1</td>
  <td style="text-align: center;">1</td>
  </tr>
  <tr>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">4</td>
  <td style="text-align: center;">AZ</td>
  <td style="text-align: center;">2</td>
  </tr>
  <tr>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">4</td>
  <td style="text-align: center;">A2</td>
  <td style="text-align: center;">3</td>
  </tr>
  <tr>
  <td style="text-align: center;">4</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">A3</td>
  <td style="text-align: center;">1</td>
  </tr>
  <tr>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">A4</td>
  <td style="text-align: center;">2</td>
  </tr>
  <tr>
  <td style="text-align: center;">6</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">AZ</td>
  <td style="text-align: center;">3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <pre class="lang-sql prettyprint-override"><code>SELECT MAX(step) AS STEP, staff_id
  FROM test AS t 
  WHERE staff_id = AZ 
  GROUP BY general_id
  </code></pre>