title: Group by and get the last row
body: <p>When I used the </p>
  
  <pre><code>SELECT * FROM reports WHERE staff='$username' GROUP BY taskid
  </code></pre>
  
  <p>on my query, I get a result of the first row from that group.</p>
  
  <p>What do I need to add to get the result from the last row of that group?</p>
  
  <p>last row means having id greater than the other row from that group.</p>
  
  <p>I tried adding </p>
  
  <pre><code>ORDER BY id DESC 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>ORDER BY id
  </code></pre>
  
  <p>but it did not return the intended result.</p>