title: Min and Max from every group
body: <p>I have two table </p>
  
  <p><strong>location:</strong></p>
  
  <ul>
  <li>location_id</li>
  <li>address</li>
  </ul>
  
  <p><strong>itransfile:</strong></p>
  
  <ul>
  <li>id</li>
  <li>transactionNumber</li>
  <li>location_id</li>
  <li>itemName</li>
  <li>quantity</li>
  </ul>
  
  <p>I want to get maximum and minimum sold items by locations.</p>
  
  <pre><code>HighestItemName     HighQauntity    LowestItemName      LowQuantity     LocationName
  
  Chicken Burger      50              Tako                5               Gulshan
  Chicken Burger      100             Tikka               10              Nipa
  Pasta               150             Cheese Burger       12              Liyari
  Pizza               200             Chicken Burger      3               F.B.Area
  </code></pre>
  
  <p>The query I've done so far:</p>
  
  <pre><code>SELECT t.itemName as HighestItemName, sum(t.quantity) as HighQuantity, l.address LocationName
      from itransfile as t join locations as l
      on t.location_id = l.location_id 
      where t.location_id IN(1,2,3,4)
      group by t.location_id
  </code></pre>
  
  <p>I don't know how will get <code>max</code> and <code>min</code> items from every group.</p>
  
  <p><strong>Sample Data:</strong></p>
  
  <pre><code>ID  TransNumber ItemName        Quantity location_id
  1   1234        Chicken Burger  3           1
  2   1234        Cheese Burger   1           1
  3   1235        Sandwich        4           2
  4   1332        Salad           1           4
  5   14537       Tikka           1           3   
  6   1236        Roll            3           2
  7   1333        Biryani         2           4
  
  
  location_id     address
  1               Gulshan
  2               Nipa
  3               Liyari
  4               F.B.Area
  </code></pre>