title: SQL - choose minimal row
body: <p>How can I get these lines (the same lines with minimal operation, and it's not always 2):</p>
  
  <p><img src="https://i.stack.imgur.com/o7iPu.jpg" alt="enter image description here"></p>
  
  <p>from this?</p>
  
  <p><img src="https://i.stack.imgur.com/gPePo.jpg" alt="enter image description here"></p>
  
  <p>And that's my select:</p>
  
  <pre><code>select SCR.order_number, SCR.product_code, REL.operation, REL.quantity
  from scrDATA as SCR INNER JOIN 
       relBDE as REL ON SCR.order_number = REL.order_number
  </code></pre>
  
  <p>I need to count a pieces for order_number and product_code (e.g. 1500 pcs for <code>order_number</code> <code>FA36001607</code> and 5 pcs for <code>order_number</code> <code>FP7201127</code>)</p>