我想知道我是否正確解碼了這個SQL邏輯。下面是在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]
謝謝你的幫助 –