title: Merge a specific table column from one database to another
body: <p>I have two SQL databases. One is an older backup of the other.</p>
  
  <p>I would like to merge only 1 specific table from [user_database0] into [user_database1] using either ssh or inside phpMyAdmin.</p>
  
  <p>That table that I want to restore from backup is called [prefix_table].</p>
  
  <p>However, I don't want to restore all columns from that table [prefix_table], just the [comment] column.</p>
  
  <hr>
  
  <p>One of my biggest concerns is that some of the  rows from the [prefix_table] have been deleted and I DO NOT want to restore those deleted rows from the old database.</p>
  
  <p><strong>Here is an Example:</strong></p>
  
  <p>*- Merge table [prefix_table]from <strong>[user_database0]</strong>:</p>
  
  <pre><code>                      prefix_table                  
  +---------------------------------------------------+
  |     id     | name  | comment    | age | person_id |
  +++++++++++++++++++++++++++++++++++++++++++++++++++++
  | 1111       | name1 | old text 1 | 01  | 001       |
  +------------+-------+------------+-----+-----------+
  | 2222       | name2 | old text 2 | 02  | 002       |
  +------------+-------+------------+-----+-----------+
  | 3333       | name3 | old text 3 | 03  | 003       |
  +------------+-------+------------+-----+-----------+
  | 4444       | name4 | old text 4 | 04  | 004       |
  +------------+-------+------------+-----+-----------+
  </code></pre>
  
  <p>*-Into table [prefix_table] in <strong>[user_database1]</strong> :</p>
  
  <pre><code>                       prefix_table                   
  +-----------------------------------------------------+
  |     id     | name    | comment    | age | person_id |
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  | 1111       | namenew | new text 1 | 99  | 001       |
  +------------+---------+------------+-----+-----------+
  | 4444       | name4   | new text 4 | 04  | 004       |
  +------------+---------+------------+-----+-----------+
  | 5555       | name5   | text 1     | 05  | 005       |
  +------------+---------+------------+-----+-----------+
  | 6666       | name6   | text 2     | 06  | 006       |
  +------------+---------+------------+-----+-----------+
  </code></pre>
  
  <p>*- <strong>Resulting</strong> database <strong>[user_database1]</strong>:</p>
  
  <pre><code>                       prefix_table                   
  +-----------------------------------------------------+
  |     id     | name    | comment    | age | person_id |
  +++++++++++++++++++++++++++++++++++++++++++++++++++++++
  | 1111       | namenew | old text 1 | 99  | 001       |
  +------------+---------+------------+-----+-----------+
  | 4444       | name4   | old text 4 | 04  | 004       |
  +------------+---------+------------+-----+-----------+
  | 5555       | name5   | text 1     | 05  | 005       |
  +------------+---------+------------+-----+-----------+
  | 6666       | name6   | text 2     | 06  | 006       |
  +------------+---------+------------+-----+-----------+
  </code></pre>
  
  <p>So it basically has to check if the table [prefix_table] matches in both databases then overwrite the data in the [comment] column. Note that if other column data changes, it should leave it as is, only the [comment] should be updated.</p>
  
  <hr>
  
  <p><strong>In Summary</strong> (both databases are on same server in one phpMyAdmin account)</p>
  
  <p>FROM: [user_database0].[prefix_table].[content]</p>
  
  <p>TO: [user_database1].[prefix_table].[content]</p>
  
  <p>IF: [id] column matches in both tables.</p>
  
  <hr>
  
  <p>Here is a <strong>working version</strong> from the recommendations below:</p>
  
  <pre><code>UPDATE
    [new_db_name].[table_name]
  INNER JOIN 
    [old_db_name].[table_name]
  ON 
    [new_db_name].[table_name].[column name] = [old_db_name].[table_name].[column name]
  SET 
    [new_db_name].[table_name].[matching column name] = [new_db_name].[table_name].[matching column name]
  </code></pre>