title: MySQL GROUP BY ignore or skip other null column
body: <p>I have a table:</p>
  
  <pre><code>(id, storage_id, product_id, quantity, property_storage_group_id)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Oe5sM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oe5sM.png" alt="enter image description here"></a></p>
  
  <p>And I need min quantity, but when <code>prouct_id</code> is several, I need to ignore <code>product_id</code> with <code>property_storage_group_id = null</code>.</p>
  
  <p>Something like this:</p>
  
  <pre><code>SELECT MIN(quantity), product_id
  FROM storage_quantity
  WHERE storage_id = 6 
  GROUP BY product_id
  </code></pre>
  
  <p>but without id 22, and with id 27.</p>