June 26, 2007 at 2:05 pm
I have the basic order level table joined to an item level table on the order number.
Each item for that order in the item table has a status column and what I want to do is a report where only the orders show that have all items' status for a particular order= 'completed'.
I've played around with several approaches and I can't see it.
When I programmed in foxpro I could have done this fairly easily but I was wondering the "best practice" solution in SQL is.
Thanks in advance
Ben
June 26, 2007 at 2:22 pm
It would help us if you would provide us your schema (table and column names), sample data, and what you want returned. That way there is no misunderstanding about what you want.
-SQLBill
June 26, 2007 at 4:00 pm
This will give you all orders where there all orderdetails are completed.
Select *
From Orders A
Where not exists (Select *
From OrderDetails B
where a.OrderNum = B.OrderNum
and OrderDetailStatus <> 'completed')
June 27, 2007 at 4:29 am
OK Ray you didn't have to make it look that easy..
Exactly what I was looking for. Thanks a million!
Ben
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply