MySQL:根据另一个表中的多个值从表中选择多个值(MySQL: Select multiple values from a table based on multiple values from another table)
我想返回所有关于这些区域的报告,这些报告属于宏观区域......
我想以某种方式
SELECT DISTINCT report FROM reports WHERE region = (SELECT distinct region from macroregions where macroregion = 'Africa')宏观区域是撒哈拉,西非,热带非洲等地区
虽然这是不可能的,因为子查询会返回多个结果。
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.
最满意答案
SELECT DISTINCT report FROM reports WHERE region IN (SELECT distinct region from macroregions where macroregion = 'Africa')也许你错过了IN运营商
SELECT DISTINCT report FROM reports WHERE region IN (SELECT distinct region from macroregions where macroregion = 'Africa')Maybe you missed IN operator
更多推荐
发布评论