I have two mySql database db1 and db2. I need to copy the data from db1 to db2. Both the databases are under the same user. The table structure is different in both the database.
The columns structure are not the same in the tables.
Example
db1.Table1
-------------------------------------------------------
| id | SessionID | Product1_Qty | Product2_qty |
-------------------------------------------------------
| 1 | 12345 | 2 | 1 |
-------------------------------------------------------
db2.Table1 (Desired Output)
--------------------------------------------
| id | SessionID | Product | Qty |
--------------------------------------------
| 1 | 12345 | Product_1 | 2 |
--------------------------------------------
| 2 | 12345 | Product_2 | 1 |
--------------------------------------------
Edit: For every sessionID (1 row) in db1.Table1 there should be 2 same sessionID (2 rows) in db2.Table1
I need the SQL script to copy data from db1.Table1 to db2.Table1.
What is the best way to achieve this?