I was looking for some help with the below query. I need to only return the first 'Carton.CartonNumber'. I tried adding something like ( Select Min(Carton.CartonNumber) as FirstCarton from Cartons group by Carton.ID) dispite much Googling but cant get it right because of all the other joins confusing me.
Please could you assist? Thank you
SELECT OrderLine.LineNo, Order.OrderNumber, Order.Description, WarehouseOrder.WhsRef, WhsPick.PickRequired, WhsPick.PickAvailable, WhsPick.EstimatedDispatch, Carton.CartonNumber FROM WhsPick INNER JOIN WarehouseOrder ON WhsPick.ID = WarehouseOrder.PickID INNER JOIN OrderLine INNER JOIN Order ON OrderLine.OrderID = Order.ID ON WarehouseOrder.ID = Order.WarehouseOrderID INNER JOIN Carton ON WhsPick.ID = Carton.PickID