0
我有SQL語法像這樣SQL CX,這是什麼意思
WITH cx (Policy_Number,Claim_Incurred)
AS (
SELECT PolicyNo
,SUM(ReservedAmt + PaidAmt - SalvageAmt + ReservedExp + PaidExp - SalvageExp)
FROM eInsurance.dbo.Claim
GROUP BY PolicyNo
)
或像這樣
REFERENCE.dbo.FXRate fx
JOIN eInsurance.dbo.PolicyM pm
ON fx.currency = pm.PRCurrency
LEFT JOIN cx
ON pm.PolicyNo = cx.Policy_Number
JOIN eInsurance.dbo.Account acc
ON pm.AccCode = acc.AccCode
JOIN eInsurance.dbo.AccTypeList atl
ON acc.AccType = atl.TypeCode
那麼,是什麼CX在其語法意味着..?
這被稱爲「公用表表達式」。基本上它就像一個子查詢,可以在隨後的查詢中引用。所以'cx'是它包含的查詢的別名。 – sgeddes