Reputation: 6737
I would like to return all the reports that are about each of these regions, that belong to a macroregion...
I would like to somehow
SELECT DISTINCT report FROM reports WHERE region =
(SELECT distinct region from macroregions where macroregion = 'Africa')
The regions in the macroregion are Sahara, West Africa, Tropical Africa,... etc
Although this is impossible since it the subquery would return multiple results.
Upvotes: 1
Views: 626
Reputation: 14859
This should get you what you need:
SELECT
r.report
FROM
reports r
INNER JOIN
macroregions m ON
m.region = r.region
AND
m.macroregion = 'Africa'
This is all of the reports associated to regions associated to the macroregion 'Africa'.
Upvotes: 2
Reputation: 48121
SELECT DISTINCT report FROM reports WHERE
region IN
(SELECT distinct region from macroregions where macroregion = 'Africa')
Maybe you missed IN
operator
Upvotes: 2