|For simplicity I have 2 tables:|
Orders = Date, OrdNum, ItemNum, TotQty
OrderDetails = OrdNum, ItemNum, OrdQty
(I did not create these tables.)
Linking fields are OrdNum and ItemNum
There is 1 record in Orders for each OrdNum/ItemNum
There are zero to many records in OrderDetails for each OrdNum/ItemNum.
The sum of OrdQty in all OrderDetails should = the TotQty of the corresponding Order rec.
I want to find all Orders in a specified date range where no OrderDetails recs exist yet, or the sum of OrdQty <> TotQty.
This should be easy. I got the ol' invalid column when I tried to use the summed column alias in the where clause and I can't get the subset workaround to work because of the link. I'm stuck. Any help would be appreciaited. Thanks.