簡體   English   中英

語法錯誤代碼:MYSQL語句中為1064

[英]Syntax Error Code: 1064 in MYSQL statement

我不明白為什么它會引發異常並花了我很多時間。 我真的很感謝您的幫助。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM