My problem is as follows – in the database I have a Products table with a size column. However, I have now created two new columns x_size and y_size and I wanted to move the values from the size column to these 2 columns. I don’t want to change everything manually because there are over 1,000 records in this table.
I have no idea how to go about it, I will be grateful for help.
UPDATE `products` SET `size` = CONCAT(x_size,' ', y_size);
Here I am using concat by white space that two-column, whatever you wish to use.
Note:- Before take back up the particular table
If you want to copy one column value to another column in MySQL perform below query.
UPDATE products SET x_size = SUBSTRING_INDEX(size,'x',+1) UPDATE products SET y_size = SUBSTRING_INDEX(size,'x',-1)