所以我有两个使用相同计算的列别名:
,case when bi.PolicyFeeFactor = 0
then 0
else
CAST(ROUND(nb.AnnualPolicyFee * bi.PolicyFeeFactor,2)AS DECIMAL(6,2))
end
as UNIT_POLFEE_Y
,case when bi.PolicyFeeFactor = 0
then 0
else
CAST(ROUND(nb.AnnualPolicyFee * bi.PolicyFeeFactor,2)AS DECIMAL(6,2))
end
as UNIT_PUPFEE_Y
我正在寻找一种方法,我可以只编写一次计算并从该语句创建两个列别名,例如:
,case when bi.PolicyFeeFactor = 0
then 0
else
CAST(ROUND(nb.AnnualPolicyFee * bi.PolicyFeeFactor,2)AS DECIMAL(6,2))
end
as UNIT_PUPFEE_Y, UNIT_POLFEE_Y