But along with the stock items, the order information is needed to be displayed. What you're suggesting, after all, is what this query already does:
I'm not sure if you're not understanding the problem, or what, but I solved my own problem by only joining the OutletOrder table on multiple conditions (essentially, move WHERE clause to JOIN clause):Code:SELECT s.StockId FROM Stock s LEFT OUTER JOIN OrderItem oi ON oi.StockID=s.StockID LEFT OUTER JOIN OutletOrder oo ON oo.OrderId=oi.OrderID WHERE (oo.OutletId=8 AND oo.RecieveDate IS NULL) OR (oo.OutletId Is Null);
Code:LEFT OUTER JOIN OutletOrder oo ON oo.OrderId=oi.OrderID AND oo.OutletId=8 AND oo.RecieveDate IS NULL




Reply With Quote