如何解决 Mode.com 上的警告:“...”处或附近的语法错误?
How to solve warning on Mode.com: syntax error at or near "..."?
我是SQL的新手,通过Tina Huang老师了解到Mode.com,一个提供相当全面的SQL教程的网站。我遇到了这个问题,不知道如何解决,你们能帮帮我吗:
SELECT
west,
midwest,
northeast,
midwest + northeast AS "midwest_northeast_combined"
FROM tutorial.us_housing_units
Where west > "midwest_northeast_combined"
然后得到这样的警告:
Looks like something went wrong with your query.
org.postgresql.util.PSQLException: ERROR: syntax error at or near "midwest"
Position: 1
"midwest_northeast_combined" 列对于 where 子句是未知的,因为在你的查询 midwest + northeast AS "midwest_northeast_combined" 在 where 子句之后计算,所以你必须在你的 where 子句中重复它:
SELECT
west,
midwest,
northeast,
midwest + northeast AS "midwest_northeast_combined"
FROM tutorial.us_housing_units
Where west > midwest + northeast
我是SQL的新手,通过Tina Huang老师了解到Mode.com,一个提供相当全面的SQL教程的网站。我遇到了这个问题,不知道如何解决,你们能帮帮我吗:
SELECT
west,
midwest,
northeast,
midwest + northeast AS "midwest_northeast_combined"
FROM tutorial.us_housing_units
Where west > "midwest_northeast_combined"
然后得到这样的警告:
Looks like something went wrong with your query.
org.postgresql.util.PSQLException: ERROR: syntax error at or near "midwest"
Position: 1
"midwest_northeast_combined" 列对于 where 子句是未知的,因为在你的查询 midwest + northeast AS "midwest_northeast_combined" 在 where 子句之后计算,所以你必须在你的 where 子句中重复它:
SELECT
west,
midwest,
northeast,
midwest + northeast AS "midwest_northeast_combined"
FROM tutorial.us_housing_units
Where west > midwest + northeast