title: Get MAX value in mysql query
body: <p>I have a table</p>
  
  <pre><code>       id     mid    userid    remarks
         1       2       8          7 
         2       2       8          6
         3       2       8          4 
         4       2       8          5
         5       2       8          2
         6       2       8          3
         7       2       8          7
         8       2       8          0
         9       2       8          1
         10      2       8          8
  </code></pre>
  
  <p>I need the last row of remark before that row. i.e., remark '1'</p>
  
  <pre><code>SELECT MAX(id),mid,userid,remarks FROM sample 
  </code></pre>