mysql - How can I copy a column from one table to another -


I get two tables I need from one table to another to copy the data based on the id.

table1

  + ---- + ------------- ----------- + ----- - + | ID | Title | Year | + ---- + ------------------------ + ------ + | 1 | Carmencia | 1894 | 2 | Le Clone et SS Chinas | 1892 | | 3 | Power Pierot | 1892 | + ---- + ------------------------ + ------ +  

table 2:

  + ---- + ------------------------ + ------ + | ID | Title | Year | + ---- + ------------------------ + ------ + | 1 | Carmencia | 0 | | 2 | Le Clone et SS Chinas | 0 | | 3 | Power Pierot | 0 | + ---- + ------------------------ + ------ +  

How to Can I copy table 2 from table 1 to table 2 from year 1 so they have the correct ID

< P> This update will match the year column in Table 2 to match the value in Table 1, where both emblems have id in both tables:

 < Joining the code> Update Table 2 on Table 1 Table 1. Table `` ID`` = Table 2```` Set Table 2.`Eyear` = Table 1 'Year';  

For reference:


Comments