MYSQL cross table update
So today update data cross table in a MYSQL database. It took me way longer than it should have. I spent way too much time trying to get my join to work only to continue getting syntax errors. So long story short. If you are doing a cross table update in MYSQL you cannot use a join. Rather you must use WHERE a simple example looks like:
UPDATE TableToUpdate, TableToPullInfoFrom
SET
TableToUpdate.col1 = TableToPullInfoFrom.col1,
TableToUpdate.col2 = TableToPullInfoFrom.col2,
TableToUpdate.col3 = TableToPullInfoFrom.col3,
TableToUpdate.col4 = TableToPullInfoFrom.col4
WHERE TableToUpdate.id = TableToPullInfoFrom.id
And I will just leave this here so I don’t make that mistake again.