我有以下表格:
+---------+-----------+----------------+---------------------+
|TravLotID|TravLineNum|ProjectCycleTime| CapacityValue |
+---------+-----------+----------------+---------------------+
| 14405 | 1 | 60 | 2011-03-16 16:00:00 |
| 14405 | 2 | 90 | |
+---------+-----------+----------------+---------------------+
我想添加一个名为FordwardSchdDate
的新字段
对于第一行,它应将ProjectCycleTime
值添加到CapacityValue
。然后累积结果。
例如,这里应该是什么结果:
+---------+-----------+----------------+---------------------+---------------------+
|TravLotID|TravLineNum|ProjectCycleTime| CapacityValue | FordwardSchdDate |
+---------+-----------+----------------+---------------------+---------------------+
| 14405 | 1 | 60 | 2011-03-16 16:00:00 | 2011-03-16 17:00:00 |
| 14405 | 2 | 90 | | 2011-03-16 18:30:00 |
+---------+-----------+----------------+---------------------+---------------------+
我需要帮助思考如何实现这一目标的逻辑。这是我到目前为止所拥有的
( CASE WHEN TravLineNum = 1
THEN dbo.fn_DateAdjustWorkingDaysOnly(0 - wt.ProjectedCycleTime, wt.CapacitySlotDateTimeValue)
ELSE ' '--dbo.fn_DateAdjustWorkingDaysOnly (wt.ProjectedCycleTime + wt.ParentMinutes, wt.SchdDate)
END ) AS ForwardSchdDate,
有什么建议吗?谢谢!