In mysql, I am trying to copy the data from one column to other column of different table. I have used the below command to achieve this.
insert ignore into user(payload) select payload from group;
data in old column is data:test
data in new column should be {“payload”:”data:test”}
As of now when I used the above insert command, it just copies the data as is from old column, I want the new column to be updated as {“payload”:”data:test”}
Advertisement
Answer
Actually that quite simple with the use of the CONCAT() function
insert ignore into user(payload) select CONCAT( '{"payload":"', payload, '"}' ) from group;