I have two tables with customer data which I wish to combine. One with very old data between 2013-2017 and one with data from 2018-now.
I basically want to stick the old data under the new data using UNION which is simple enough. However, I have old customers who exist in both tables (can be joined on customer_id).
Ideally, the query I write will do the following:
If the customer_id is present in the new data, it will just update newtable.starting_date with oldtable.starting_date.
If the customer_id is NOT present in the new data, the entire row will be added to the table.
I am doing this in MySQL.