Reputation: 377
This is probably trivial but I can't seem to get it. I'd like to get all the customers of all the stores in a particular area.
select * from customers
where customer... ???
... and area = 'downtown'
Their relationship:
area - 1:M - store - 1:M - customer
Upvotes: 0
Views: 19
Reputation: 10277
I'd just use a subquery. Assuming this is across two tables then:
SELECT *
FROM CUSTOMERS
WHERE STORE(ID) IN
(SELECT STOREID
FROM STORES
WHERE AREA = DOWNTOWN)
Upvotes: 1