SuperComputing
IS-IT--Management
Forgive me if I've posted this in the wrong forum...
We have a Database 'CP' with several tables, one of which is 'Customers'. We went into the 'Customers' table and made changes to both the 'SalesRep' column and the 'Category' column. Now, 45 days later, they want the changes made to the 'SalesRep' column to be undone.
I have a backup of the table before any changes were made and I have restored it to 'CustomersOLD' and have gone in and updated the 'Category' column and left the 'SalesRep' column alone. However, the current table has had 300+ new customers added and several hundred of the rows of the existing customers have been modified. I can't simply import the new customers into the old table and replace.
I don't know if the syntax exists, can I combine the 2 tables, based on the 'CustomerNumber' column, and update the existing 'SalesRep' column with the data that is in the 'CustomersOLD' table, 'SalesRep' column?
UPDATE Customers SET 'SalesRep' = 'CustomersOLD.SalesRep' WHERE 'Customers.CustomerNumber' = 'CustomersOLD.CustomerNumber'
Since the 'CustomerNumber' is incremental, do I need to run a FOR loop?
Thanks for all of your help!
We have a Database 'CP' with several tables, one of which is 'Customers'. We went into the 'Customers' table and made changes to both the 'SalesRep' column and the 'Category' column. Now, 45 days later, they want the changes made to the 'SalesRep' column to be undone.
I have a backup of the table before any changes were made and I have restored it to 'CustomersOLD' and have gone in and updated the 'Category' column and left the 'SalesRep' column alone. However, the current table has had 300+ new customers added and several hundred of the rows of the existing customers have been modified. I can't simply import the new customers into the old table and replace.
I don't know if the syntax exists, can I combine the 2 tables, based on the 'CustomerNumber' column, and update the existing 'SalesRep' column with the data that is in the 'CustomersOLD' table, 'SalesRep' column?
UPDATE Customers SET 'SalesRep' = 'CustomersOLD.SalesRep' WHERE 'Customers.CustomerNumber' = 'CustomersOLD.CustomerNumber'
Since the 'CustomerNumber' is incremental, do I need to run a FOR loop?
Thanks for all of your help!