I have some code like this:
Update table_name
set
[column] = case when d.data is null, then null else d.columnname end.
from...
etc
My question is, how do I set up a function where the ‘else d.columnname’ is to sum up several columns from joins.
Would it be something like:
...then null else sum(d.column1 + rf.column2 + rwf.column3) as tempcolumn end,
or
...then null else (d.column1 + rf.column2 + rwf.column3) end,
What is the correct way to do a column sum in this set situation?
You can simply do:
CASEwill returnNULLby default when there is no match.