I would like to overwrite rows in a table1, with other ones in table2, same database.
For example, table1 has following data:
COL1 | Col2 | Col3 | Col4 | Col5 | idDie
----------------------------------------------
0001 | unknown | unknown | unknown | unknown | frKey1
0002 | unknown | unknown | unknown | unknown | frKey2
0003 | unknown | unknown | unknown | unknown | frKey3
0004 | unknown | unknown | unknown | unknown | frKey4
0005 | unknown | unknown | unknown | unknown | frKey5
0006 | unknown | unknown | unknown | unknown | frKey6
and table2:
COL1 | Col4 | Col5 | Col6 | Col7
---------------------------------
0003 | value | value | value | value
0004 | value | value | value | value
0005 | value | value | value | value
So I want to overwrite the default data in table1, with data from table 2 (table2 has same column-names but not all columns as table1! just a couple of columns) in the range where COL1 > 0002 and COL1 < 0006
And there is another table3, which has the following form:
idDie | Col22 | Col33 | Col44
frKey1 | unknown | unknown | unknown frKey2 | unknown | unknown | unknown frKey3 | unknown | unknown | unknown frKey4 | unknown | unknown | unknown frKey5 | unknown | unknown | unknown frKey6 | unknown | unknown | unknown
The Dies with the id's frKey3, frKey3 and frKey4 should be overwritten as well. They have a reference, foreign key, in table1, and Col6 and Col7 information in table2 are informations that should be copied to table3.
Is it possible to do that in just one sql-statement?