Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 6 个指标列的事实表,三个日期键列仍然是外键,我需要根据该事实表设计一个预算表,例如
1)当年预算=去年事实+10%(去年事实)
2)当前季度预算=上季度事实+10%(上季度事实)
3)当月预算=上个月事实+10%(上个月事实)
这个伪代码有意义吗?
SELECT DATEPART(YEAR, GETDATE()), YearFact * 1.1 AS YearBudget, QuarterFact * 1.1 AS QuarterBudget, MonthFact * 1.1 AS MonthBudget FROM FactTable WHERE DATEPART(YEAR, FactDate) = DATEPART(YEAR, GETDATE()) - 1;