I have a temporary table #result that looks basically like this:
unit_number deferral_days
1 50
2 20
3 102
And a table lab_unit that has the same fields. I want to update lab_unit for each unit_number with the deferral_days value from #result. Right now I'm using a sub-select that looks like this:
but it's not working properly as it sets deferral_day values in lab_unit to NULL for certain units, which shouldn't happen. I've heard of an "update from" syntax that might be helpful here, but I can't find good documentation on it...anyone able to help me out?
unit_number deferral_days
1 50
2 20
3 102
And a table lab_unit that has the same fields. I want to update lab_unit for each unit_number with the deferral_days value from #result. Right now I'm using a sub-select that looks like this:
Code:
update
lab_unit
set
deferral_days =
(select top 1
#result.deferral_days
from
#result
where
lab_unit.unit_number = #result.unit_number)