作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
运行下面的查询时,我最终在 PHPMyAdmin 中遇到 MYSQL 错误:
我正在使用 mysql 5.6 和 phpMyAdmin,Proximite 出现错误,请我需要帮助例如,查找距离巴黎埃菲尔铁塔最近的 10 家餐厅(纬度:48.858205,经度:2.294359)且距离小于 1 公里。该数据库包含一个表“restaurants”。该表包含与餐厅的纬度和经度相对应的“lat”和“lng”等字段这是我的尝试:
SELECT *, get_distance_metres('48.858205', '2.294359', lat, lng)
AS proximite
FROM restaurants
WHERE proximite < 1000 ORDER BY proximite ASC
LIMIT 10
最佳答案
您不能在相同查询的WHERE
子句中使用该别名。
试试这个:
SELECT *, get_distance_metres('48.858205', '2.294359', lat, lng)
AS proximite
FROM restaurants
WHERE get_distance_metres('48.858205', '2.294359', lat, lng) < 1000
ORDER BY proximite ASC
LIMIT 10
文档:
Standard SQL disallows references to column aliases in a WHERE clause. This restriction is imposed because when the WHERE clause is evaluated, the column value may not yet have been determined.
<强> Source
关于mysql - #1054 - MySQL 中 'proximite' 中的未知列 'where clause',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22538579/
运行下面的查询时,我最终在 PHPMyAdmin 中遇到 MYSQL 错误: 1054 - “where 子句”中存在未知列“proximite” 我正在使用 mysql 5.6 和 phpMyAdm
我是一名优秀的程序员,十分优秀!