I am looking for a better method to update a table than a utilizing a series of looping complex select/update statements. Some ideas/suggestions on how to structure the code would be great.
The requirement is to take the input table and arrange the order per the specific order table AND substitute where necessary to update
an output table. The code must handle any input table and specific order table combination or variation.
Below is a simplified example.
My existing code worked great until
there were different DAIRY items in the input table, and/or DAIRY was listed twice in the specific order table.
Input Table
-----------
Milk
Beer
Cheese
Hotdogs
Specific Order Table
---------------------
order item
1 Hotdogs
2 Dairy
3 Beer
4 Dairy
Dairy Lookup Table
------------------
Cheese
Milk
Ice Cream
Butter
Output Table
--------------------
order item
1 Hotdogs
2 Milk
3 Beer
4 Cheese
(Don't care about the resulting order of dairy items)
Hope you can help!