Return 2 lines from a table if one line contains a column > 0 and the other is NULL
select t1.*
from the_table t1
where t1.location_id in (1,2)
  and exists (select * 
              from the_table t2
              where t1.item_id = t2.item_id 
                and t2.quantity &gt; 0
                and t2.location_id in (1,2));


The condition t2.quantity &gt; 0 will be false for null values, so if all quantities for an item_id are null the where condition will be false, and the corresponding item will not be returned

Online example: http://rextester.com/NSRQ98002