Update one Table's data from another table in MYSQL
From time to time I need to update lots of records on a production MySQL server from a data on a development SQL server. There are some fairly impressive tools for doing this, BUT in this case all I have is phpMySQLAdmin on the production server. I have used this "Cross Table Update" before, but it still takes me about 20 mins to find the example query. So, I thought it would be handy to put it in my blog.
INNER JOIN trainingcourse_Updates B
ON A.ID = B.ID
SET A.CourseDescription = B.CourseDescription, A.AgendaDescriptionLink = B.AgendaDescriptionLink
Just a bit of explanation: CourseDescription and AgendaDescriptionLink are the two fields that need to be updated in the table TrainingCourse from the table trainingcourse_Updates. trainingcourse_Updates has 3 columns in this case, ID, CourseDescription and AgendaDescriptionLink.

There are no comments for this entry.
[Add Comment]