I have two tables: Customers and Addresses. There can only be 1 customer record, but a customer may have multiple addresses. Each address has true/false field called “active”.
I’m trying to design a query that selects any customers that don’t have an active address. So customers with address records that are all marked “active = false”, or have no address records at all.
I’m working in Access for this, so the SQL needs to be MS friendly. However I am interested to know the general SQL technique to do this kind of selection.
Edit:
Table Structure
Customers
CustomerID, CustomerName, CustomerDoB
Addresses
AddressID, AddressName, AddressPostcode, CustomerID, Active
This should point you in the right direction, without the table schema I’ve made some assumptions:
This assumes an ID in the customer table and a CustomerID in the addresses table