I'm trying to return only 1 row for each order.
An order can have multiple line items.
I want to check each line item to make sure the quantity in stock is greater than 0.
Right now, there is an order that has two lines and both are in stock, but I just want it to return one row.
I pretty much just need a couple columns from the orders table and not the line items table.
FROM Orders a
INNER JOIN LineItems b
ON a.OrderID = b.OrderID
INNER JOIN Products c ON c.ProductID = b.ProductID
c.QuantityInStock > 0
a.OrderStatusID = 1
a.GatewaySuccessful = 1
a.ToBePrinted = 1