I want to get customers that exist in the customer table but not in the orderhed table. How can I get that in a BAQ?
In SQL I can use a where not exists. What does that translate to in a BAQ?
select * from Customer
where NOT EXISTS (select * from OrderHed where OrderHed.CustNum = Customer.CustNum)
You can also do an except query. You would put your customers on the top level, then the orderHead on the except level, and it will give you a list of customer numbers that don’t have orders. Then use that to get what you need on the next level up.
@Olga, for grins and giggles I tried the not-exists, and that just returned nothing. I don’t believe that works as expected. Or am I doing something wrong there?
I use this method by @hackaphreaka all the time and believe it is the simplest to implement in a BAQ. Just create a left join from Customer to OrderHed and then use OrderHed.Company ISNULL in your subquery criteria.