My query is below, but for some reason PostgreSQL is not recognizing the row. Let me know what is wrong here. I am using PgAdmin 4 also.
QUERY:
SELECT date_part('year',end_of_quarter) as yr,industry,sum(gdp) as totalgdp FROM
(SELECT * FROM income where industry IN ('Mining','Construction','Utilities')) as MCU
GROUP BY yr,industry
HAVING yr = 2013
ORDER BY totalgdp desc;
RESULT:
ERROR: column "yr" does not exist
LINE 4: having yr = 2013
^
SQL state: 42703
Character: 196