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.

UPDATE TrainingCourse A
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.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.001. Contact Blog Owner