I am trying to populate a column (2003_revenue) with the sum of two columns, STB and Addon that exist in the temp table #CombinedRevTable_2003. However, if both STB and Addon are null, I want to populate the column with Null.
I keep getting an error with my code that there is incorrect syntax near the keyword 'from'.
UPDATE data.revenuesummary
SET 2003_Revenue = (
SELECT CASE
WHEN (STB IS NULL AND Addon IS NULL) THEN NULL
ELSE SUM(ISNULL(STB,0)) + SUM(ISNULL(Addon,0))
FROM #CombinedRevTable_2003 b
WHERE b.ID = data.revenuesummary.ID
)
Any assistance would be greatly appreciated.
Thanks!