更新时间:2023-02-10 19:20:49
一种方法是将整个现有查询放入 CTE,然后您可以从中选择并执行计算.
One way would just be to chuck your entire existing query into a CTE then you can select from that and perform the calculations.
;WITH CTE
AS (
/*Paste your existing query*/
)
SELECT *,
Sum_SalesStores / Sum_Products AS Foo,
Sum_SalesStores / Sum_Stores AS Bar
FROM CTE
ORDER BY Foo,
Bar