gpt4 book ai didi

mysql - 语法错误代码: 1064 in MYSQL statement

转载 作者:行者123 更新时间:2023-11-29 16:36:05 24 4
gpt4 key购买 nike

我不明白为什么它会抛出异常并花费了我很多时间。我真的很感激任何帮助。

这是mysql语句

 use dvdrental;

Select S.city From S OS
Where EXISTS (select top(1) S.city,
Count(S.s_num) From S In S
Where In S.city = OS.city Group By S.city
Order by Count(S.s_num) DESC)

异常(exception)是

  Error Code: 1064. 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 '.city,
Count(S.s_num) From S In S Where In S.city = OS.city Group By S.city Orde' at line 2

谢谢

最佳答案

要具体,因为:

MYSQL:没有像

那样的 TOP
select top(1)

你必须这样使用:

limit 1 

最后

像这样:

Select S.city From S OS Where EXISTS 
(select S.city, Count(S.s_num) From S In S Where In S.city = OS.city Group By S.city Order by Count(S.s_num) DESC limit 1)

关于mysql - 语法错误代码: 1064 in MYSQL statement,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53604816/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com