Wednesday, July 24, 2013

MySQL Copy one column in a table to another column in another table

I had two tables. One had a status field that I wanted in another table.

Below is the diagram showing the two tables:

To get it to copy the data, I just used the command below:

 update tablea  
     inner join  
   tableb ON tablea.Task_id = tableb .Task_id  
 set   
   tablea.status= tableb .status;