In Sports database, how can I select ONLY 'Customers' with no 'Orders' in one OPEN QUERY statement ?
Regards
Andrzej
This is a useful trick I found many years ago that seems to work:
define temp-table ttNoOrder field field1 as char. create ttNoOrder. define query q1 for Customer, Order, ttNoOrder. open query q1 for each Customer no-lock, first Order of Customer outer-join no-lock, first ttNoOrder where not available(Order). get first q1. repeat while not query-off-end("q1"): display Customer.CustNum Customer.Name available(Order). get next q1. end.
normally you could but apparently it doesn’t really work, or I just expect it to behave differently :)
This is a useful trick I found many years ago that seems to work:
define temp-table ttNoOrder field field1 as char. create ttNoOrder. define query q1 for Customer, Order, ttNoOrder. open query q1 for each Customer no-lock, first Order of Customer outer-join no-lock, first ttNoOrder where not available(Order). get first q1. repeat while not query-off-end("q1"): display Customer.CustNum Customer.Name available(Order). get next q1. end.
Thank you very much Steve. Fantastic trick.