0
我已經負責基於OrdinalPosition創建一個sql腳本,據我所知我的代碼應該可以工作,但顯然最後一個「ViewData」附近有一個「不正確的語法」錯誤.SONumber「,我無法解決和無法識別。有人可以看一看,看看我的大腦是不是正在處理的東西?Pivot中的語法不正確
FROM tblReps RIGHT OUTER JOIN tblServiceOrders RIGHT OUTER JOIN dbo.tblCustomFieldDefinitions LEFT OUTER JOIN
(SELECT SONumber, [1] AS [ShippingCompany], [2] AS [Consignment_Number]
FROM (SELECT tvw_CustomSOFieldData.SONumber, tvw_CustomSOFieldData.CustomFieldValue, tvw_CustomSOFieldData.OrdinalPosition
FROM tvw_CustomSOFieldData)
PivotData PIVOT(max(CustomFieldValue) FOR OrdinalPosition IN ([1], [2])) AS CustomFieldsPivot)
AS ViewData ON tblServiceOrders.SONumber = ViewData.SONumber
但當然!謝謝你,先生,這樣一個簡單而愚蠢的錯誤 – LordJubbles
也許語法鼓勵它。 –