语法错误代码:MYSQL语句中的1064



我不明白它为什么抛出异常,花了我很多时间。如果有任何帮助,我将不胜感激。

这是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)

是个例外

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) 

相关内容

  • 没有找到相关文章

最新更新