I have the following tables:
Table A:
id int
v1 string
v2 string
Table B:
key int
val string
Table A_v2:
id int
v1 int
v2 int
I have data loaded in tables A and B. I am trying to convert table A to table A_v2, by replacing each value (in columns v1 and v2) with the corresponding key from table B.
I hope this makes sense. If not I can give an example.
I am using SQLite.
How would I write the insert?
EDIT
Here is an example:
Row in A:
1 | abc | def
Rows in B:
5 | abc
42 | def
Row in A_v2 should then be:
1 | 5 | 42
As what I understood is .. you want to replace V1 and V2 column of TABLE_A with value of column VAL in TABLE_B.
if so you can use following query ..
I am not much sure about sqlite .. but this commands are valid and working as per oracle database.