我收到一個語法錯誤,有人可以告訴我爲什麼?SQL子查詢中的語法錯誤
SELECT c.clientid, c.clientname, c.billingdate,
(SELECT TOP 1 previousbalance FROM invoice i
WHERE i.client = c.clientid ORDER BY i.invoiceid DESC) AS remaining
FROM client c
ORDER BY clientname
什麼二次選擇做的是讓在發票表clientid
的最新記錄。
程序 - HediSQl
SQL
這裏是錯誤:
SQL Error (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 '1 previousbalance FROM invoice i WHERE i.client = c.clientid ORDER BY i.invoicei' at line 1 */
請在這裏展示的語法錯誤。和哪個SQL(MySQL,SQL Server等)? – hims056
HediSQL是程序,SQL,這裏是錯誤'SQL錯誤(1064):你的SQL語法錯誤;檢查對應於您的MySQL服務器版本的手冊,以找到正確的語法,以便在第1行的'1 previousbalance FROM invoice i WHERE i.client = c.clientid ORDER BY i.invoicei'* /' – user1269625