I am using 3 tables for this, Part, PartDrawing and ShopDrawing. Basically I want to display all ShopDrawings where all their Parts are in stock. However each ShopDrawing has multiple PartDrawings that go with it so when I run my query like this:
SELECT DISTINCT ShopDrawing.DrawingNo FROM ShopDrawing, PartDrawing, Part
WHERE ShopDrawing.DrawingNo = PartDrawing.DrawingNo
AND PartDrawing.PartNo = Part.PartNo
AND Part.InStock = 'YES';
It displays every single ShopDrawing because they all have at least one Part that is in stock. I only want want it to display the ShopDrawings where all the Parts that are needed for it are in stock, and I’m not sure how to do this.
Try to evaluate by not select data with
Part.InStock = 'NO'rather than select data withPart.InStock = 'YES'