Avatar of brihol44
brihol44

asked on 

How can I update two new tables from one old table.

Hello, I'm doing a data conversion from a old cart to a new one. I'm able to update the old customer info into the new table however with my new cart I have two tables.

Table 1: customers_new that has address, city, zip and general info.
Table 2: customers_stateprov_new that has the state id linked to it (data and structure below)

record_id | customer_state_customer_id |  customer_state_stateprov_id  | customer_state_destination

1 | 1000  | 37 | BillTo
2 | 1000  | 37 | ShipTo
3 | 1001  | 1   | BillTo
4 | 1001  | 1   | ShipTo

The old customer table has all of the info tied into the one table so I'm wanting to build out the customers_stateprov table with the old table data. I was able to export the old table to the new table following this basic query but as you can see it doesn't solve last step of building out the stateprov table

INSERT INTO tbl_new_customers (cust_id, cust_name, cust_addr1)
SELECT customer_id, customer_name, customer_address1
FROM tbl_old_customers
MySQL ServerSQL

Avatar of undefined
Last Comment
johanntagle

8/22/2022 - Mon