我在select
查询中创建了一个文字,最后我尝试使用having
查找结果为distance < 50000
的文字。
来自MySql
背景,我认为此查询应该工作。
SELECT "description",
"location",
ST_Distance_Sphere(location, ST_MakePoint(-126.4,45.32)) AS "distance"
FROM "news_agencies" AS "news_agencies"
HAVING distance < 50000;
我还尝试在having >>>"distance"<<<
文字周围添加引号。如果我删除“having distance < 50000
”,我的查询运行正常并计算距离。这是我的错误:
column "distance" does not exist
答案 0 :(得分:2)
您不能在123
子句中使用别名。试试这样:
having