开发者

Why is my query causing a 1064 (42000) error?

Query issues, for the life of me i cant figure out what is wrong with this query

HAVIN开发者_JS百科G 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


HAVING goes after GROUP BY. MySQL is picky this way.


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.


I don't do MySQL, but in the SQL I'm used to, the HAVING clause needs to go after the GROUP BY clause.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜