为什么我的查询会导致 1064 (42000) 错误?
查询问题,我一生都无法弄清楚这个查询出了什么问题
HAVING distance ='10'
GROUP BY c.ancient,
c.ant_name,
p.upper,
p.name,
错误 1064 (42000):您遇到错误 在你的 SQL 语法中;检查手册 对应于您的 MySQL 服务器 正确使用语法的版本 靠近 'GROUP BY c.city_id, c.city_name, p.prop_ynow_id、p.Name、pr.PRE_Ident 在第 1 行选择 dis'
Query issues, for the life of me i cant figure out what is wrong with this query
HAVING distance ='10'
GROUP BY c.ancient,
c.ant_name,
p.upper,
p.name,
ERROR 1064 (42000): You have an error
in your SQL syntax; check the manual
that corresponds to your MySQL server
version for the right syntax to use
near 'GROUP BY c.city_id, c.city_name,
p.prop_ynow_id, p.Name, pr.PRE_Ident
SELECT dis' at line 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
HAVING
位于GROUP BY
之后。 MySQL 就是这样挑剔的。HAVING
goes afterGROUP BY
. MySQL is picky this way.虽然有点晚了,但根据我的经验,任何标准 SQL 中的查询通常都必须执行:
INSERT、
删除,
选择,
从,
在哪里,
分组依据,
拥有,按
顺序排序。
A little late to the party but Queries in any standard SQL from my experience generally have to go:
INSERT,
DELETE,
SELECT,
FROM,
WHERE,
GROUP BY,
HAVING, ORDER BY
Order.
我不做MySQL,但是在我习惯的SQL中,HAVING子句需要放在GROUP BY子句之后。
I don't do MySQL, but in the SQL I'm used to, the HAVING clause needs to go after the GROUP BY clause.