How to select Sales Orders where all lines and closed, yet the order is still in booked status?
Hello,
I'm new to SQL. I need to be able to select Sales Orders where all the LINES have Status = Closed and the HEADER has a Status = Booked. This is for RMA (customer return) sales orders. We discovered a system issue where the header is not automatically closing after all lines are fulfilled/closed, so I want to find the volume of sales order records with this condition.
Below is what I have so far. What do I need to add to this statement to only select headers where ALL lines are closed?
SELECT ooh.order_number, ool.line_number