[update: I am using MySQL 4.1.25 ]
I think this must be a simple thing to do, but I'm a SQL noob and need some help. I have a lookup table that is something like:
lookup_table
key1, value1
key2, value2
key3, value3
...
keyN, valueN
Then I have another table that has a random list of the keys (with repeats) in one column and I need to add the associated values in the corresponding column.
For example, the second table might be:
second_table
key3, ?
key1, ?
key1, ?
key40, ?
I need to replace the ?s in second_table
with the values from lookup_table
as follows:
second_table (updated)
key3, value3
key1, value1
key1, value1
key40, value40
This seems like something that a simple SQL query should address. Any suggestions?