I have two simple mysql tables with two columns each: ISBN and title.
The first table has some ISBN numbers where the titles are actually missing.
The second table has ISBN numbers where all the titles are filled in (none are missing).
I want to update the first table with the titles from the second table.
Example:
Table One:
0123456789 “The Bible”
1234567890 “”
2345678901 “Ten Commandments”
Table Two:
0000000000 “Hamlet”
1234567890 “Midsummers Dream”
2345678901 “Ten Commandments”
(because ISBN 1234567890 in table one is ‘empty’ I would like it to be populated with the data from table two, which in this example, is the title “Midsummers Dream”).
I have found this mySQL command works:
update Table1,Table2 set Table1.title=Table2.title where Table1.isbn=Table2.isbn
However, when I "google search’ the “correct” way to do this, most of the answers use an “inner join” syntax, like this:
update Table1 INNER JOIN Table2 on Table1.isbn=Table2.isbn set Table1.title=Table2.title where Table1.isbn=Table2.isbn;
The “INNER JOIN” style seems longer and more complicated. Is there some reason that my simpler version is bad?