 <p>This would be where you use Left Join and Group By. If all you need is the count of items from b, that is.</p> <pre><code>SELECT a.id id,a.price price,a.stock stock, a.max_per_user max_per_user,a.purchased purchased, COUNT(b.quantity owned) as quantity_owned FROM shop_items a LEFT JOIN shop_inventory b ON b.iid=a.id AND b.cid=a.cid WHERE a.cid=1 AND a.szbid=0 AND a.id IN(3,4) GROUP BY a.id </code></pre>