我想知道我是否正确解码了这个 SQL 逻辑。这是SQL:
,[hrs].[Hours] - SUM(CASE WHEN [UnitState].[UnitStateType] <> 'ACTIVE' THEN [Allocation].[AllocatedEnergyMwh] ELSE 0 END / CAST([Unit].[NetDependableCapacity] AS FLOAT)) AS SH
我将其解释为:
if [UnitState].[UnitStateType] does not equal active then SH equals the sum of [Allocation].[AllocatedEnergyMwh] /
(float)[Unit].[NetDependableCapacity].
else SH = [hrs].[Hours]