I am trying to update a table (Table1) that has multiple columns..
id     Engine      Transmission     Exhaust      Axle
--     -------       -------        --------    ------
1        CC              NX1           BP1       F1
2        C1              NX2           BP2       F2
3        C2              NX3           BP3       F3
I want to update this table using Name and Value in Table2...
id     Name                Value     
--     -------            -------       
1       Engine              C4          
2       Transmission        NX4          
3       Exhaust             BP5         
4       Axle                 F4
Joining the two tables is easy based on just ID. But is it possible to 'dynamically' update the columns in Table1 with Table2.Value using Table2.Name. Some how using Table2.Name to know which column in Table1 will be updated with Table2.Value?
So far I've only been able to think of a basic SELECT to pull the data I am looking for based on a WHERE EXISTS:
SELECT * FROM table1 t1
Where exists (Select NULL
           from scpomgr.table2 t2
           WHERE t1.id = t2.id);
The results would be table1:
id     Engine      Transmission     Exhaust      Axle
--     -------       -------        --------    ------
1        C4              NX1           BP1       F1
2        C1              NX4           BP2       F2
3        C2              NX3           BP5       F3
4        C3              NX5           BP4       F4
 
    