我有一个查询:
SELECT [outer].*,
(total_pain_patients / NULLIF ((SELECT Sum(total_pain_patients)
FROM [topplansperprovider]
WHERE [outer].[INDEX_IMSID] = [INDEX_IMSID]
AND plan_rank BETWEEN 1 AND 10), 0)) * 100 AS PercentOf,
pm.*,
percentof * pm.score
FROM [topplansperprovider] AS [outer]
left JOIN [payer Mapping] pm
on lower([outer].Plan_Name_OR_Payment_Type)=lower(pm.[ims payer name])
WHERE INDEX_IMSID = '1753841'
ORDER BY 6 ASC
我的问题是选择这个:
percentof * pm.score
由于percentof
是派生列的别名,我不知道如何在其他列中使用它。
- 我该如何选择
percentof * pm.score
? - 如果这太难了,我怎样才能将
percentof
作为永久列添加到我的表中?