title: Mysql How can i find max and min after sum a column
body: <p><a href="http://prntscr.com/7gtp9w" rel="nofollow">This is my code from tables</a></p>
  
  <p>i want to select from it the first two and the last two rows as a result. is that possible?</p>
  
  <p>in other words i want to select min and max of a column after it was summed. prefer two of each if possible
  thanks a lot</p>
  
  <pre><code>`select A.prod_id, SUM(quantity) Total 
   from charging A 
    group by prod_id 
    order by total`
  </code></pre>