viernes, 7 de agosto de 2015

MySQL - Update from one table to another based on a ID match

My SQL skills are close to NONE, I've struggled with this simple task more than I would like to accept. Hence, this first post.
UPDATE table1, table2
SET table1.columnA = table2.columnA,
table1.columnB = table2.columnB,
[...]
WHERE table1.id = table2.id

Overture

I am what a geek would call "Script Kiddie"
I'm no expert in any programming language even though I've worked with many of them over the years. My method? Find a solution for a problem I have right now, comparing it with a similar problem someone already had. Learn from it, adapt it and move on.

This last part, moving on, leaves most of this learning experience lost in the depths of my mind. It's this the reason why I'm starting this blog.

I hope that my findings and experiences can help others in times of need.

Dante