Not sure if this is possible, but I have a field in a table which needs to be updated by a value from another table, but references a specific column e.g. if it’s 1 then get the value out of the [Jan] column etc.
Update table1
Set Total =
CASE @count
WHEN 1 THEN [Jan]
WHEN 2 THEN [Feb]
WHEN 3 THEN [Mar]
WHEN 4 THEN [Apr]
WHEN 5 THEN [May]
WHEN 6 THEN [Jun]
WHEN 7 THEN [Jul]
WHEN 8 THEN [Aug]
WHEN 9 THEN [Sep]
WHEN 10 THEN [Oct]
WHEN 11 THEN [Nov]
WHEN 12 THEN [Dec]
END
from table2
Thanks in advance
1 Answer