当我在mysql中运行下面的sql查询时
select distinct city, length(city) from station order by length(city), order by city asc limit 1;
我犯了个错误
ERROR 1064 (42000) at line 1: 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 'order by city asc limit 1' at line 1
我不明白我在哪里犯了这个错误
2条答案
按热度按时间7lrncoxx1#
只允许一个order by,然后用逗号分隔列名,如
91zkwejq2#
你有
order by
两次。大概你想要:也就是说,一个
order by
可以有多个键。