【发布时间】:2021-09-22 06:22:02
【问题描述】:
当我尝试从查询中排除空值时,我无法理解弹出的此错误。谢谢!
/* Looking at countries with Highest Infection Rate compared to Population */
SELECT LOCATION, population,
MAX(total_cases) AS highest_infection_count,
MAX((total_cases/population))*100 AS percent_population_infected
FROM public.Covid_deaths
WHERE percent_population_infected IS NOT NULL
GROUP BY LOCATION, population
ORDER BY percent_population_infected DESC;
SQL Error [42703]: ERROR: column "percent_population_infected" does not exist
【问题讨论】:
-
别名 (percent_population_infected) 不能在 WHERE 子句中使用。
标签: sql postgresql dbeaver