Reputation: 1
I have sql syntax something like this
WITH cx (Policy_Number,Claim_Incurred)
AS (
SELECT PolicyNo
,SUM(ReservedAmt + PaidAmt - SalvageAmt + ReservedExp + PaidExp - SalvageExp)
FROM eInsurance.dbo.Claim
GROUP BY PolicyNo
)
or something like this
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
So what does cx means in its syntax..?
Upvotes: 0
Views: 236
Reputation: 1270463
cx
is called a common table expression, usually referred to as a CTE.
You can think of it as a temporary view on the data, defined only for a single query. You could replace the cx
with the definition in the with
clause.
Upvotes: 1