1
我試圖爲每條記錄添加百分位值作爲新列。但我在我的SQL查詢中出現錯誤。任何人都可以請幫忙解決它。SQL Server查詢中的錯誤 - 內部連接
錯誤消息: 消息156,級別15,狀態1,行3 關鍵字'內部'附近的語法不正確。 Msg 102,Level 15,State 1,Line 6 「a」附近語法不正確。
Select b.* , a.[Rank_1]/count(b.[Date]) * 100 as Percentile from
[Country_table1$] b where [Country] = 'AUSTRALIA'
inner join
(
select [MSCI_Price_idx], [Country], rank() OVER (PARTITION BY [Country]
ORDER BY [MSCI_Price_idx] DESC) AS [Rank_1]
from [Country_table1$]
GROUP BY [MSCI_Price_idx],[Country]
) a
ON a.[Country] = b.[Country]
可能會將'where [country] ='AUSTRALIA''放在您的線路下方ON A. [Country] = b。[Country]'? –
你應該查詢查詢的基本語法。然後你會意識到where子句完全在錯誤的地方。 –