title: MySQL - How to insert or update from source table to target table with different Keys?
body: <p>I have 2 tables with different structures.</p>
  <pre><code>CREATE TABLE test1
  (
      id INTEGER PRIMARY KEY,
      EmpName VARCHAR(50),
      Empid INTEGER
  );
  
  CREATE TABLE test2
  (
      Empid INTEGER PRIMARY KEY,
      EmpFName VARCHAR(50),   
      EmpLName VARCHAR(50)
  );
  </code></pre>
  <p>Is there a way to insert rows from test2 table into test1? If the row exists in test1 it should update the row as well. I think it's possible with Merge statement but it's not available for MySQL. Is there a similar function like this in MySQL?</p>
  <p>I've looked into <em>INSERT ... ON DUPLICATE KEY UPDATE</em> but the tables should have the same primary keys.</p>