title: MySQL equivalent to perform UPDATE SET FROM / MERGE INTO
body: <p>The table: </p>
  
  <pre><code>CREATE TABLE `vendor_contacts` (
    `vendor_id` int(11) NOT NULL,
    `last_name` varchar(50) NOT NULL,
    `first_name` varchar(50) NOT NULL,
    `name_initials` varchar(45),
    PRIMARY KEY (`vendor_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>With the following insert statement:</p>
  
  <pre><code>INSERT INTO `vendor_contacts`
      VALUES (5,'Davison','Michelle',''),
             (12,'Mayteh','Kendall',''),
             (17,'Onandonga','Bruce',''),
             (44,'Antavius','Anthony',''),
             (76,'Bradlee','Danny',''),
             (94,'Suscipe','Reynaldo',''),
             (101,'O\'Sullivan','Geraldine',''),
             (123,'Bucket','Charles','');
  </code></pre>
  
  <p>I am trying to assign the the column, name_initials with the following command, derived from a PostgreSQL [Update>Set>From]:</p>
  
  <pre><code>UPDATE vendor_contacts
  SET name_initials = t.initials
  FROM (
          SELECT vendor_id, last_name, first_name,
              CONCAT(LEFT(first_name, 1), LEFT(last_name, 1)) as initials
          FROM vendor_contacts;
  ) t 
  WHERE vendor_id = t.vendor_id;
  </code></pre>
  
  <p>Since that didn't work I tried the Oracle SQL Merge Into:</p>
  
  <pre><code>MERGE INTO vendor_contacts
  USING (
          SELECT vendor_id, last_name, first_name,
              CONCAT(LEFT(first_name, 1), LEFT(last_name, 1)) as initials
          FROM vendor_contacts;
        ) t
  ON (vendor_id = t.vendor_id)
  WHEN matched THEN
      UPDATE SET name_initials = t.initials;
  </code></pre>
  
  <p>MERGE didn't work.</p>
  
  <p>I tried a subquery, which did not work as well:</p>
  
  <pre><code>UPDATE vendor_contacts vc
  SET name_initials = (SELECT CONCAT(LEFT(first_name, 1), LEFT(last_name, 1))
                       FROM vendor_contacts vcsq
                       WHERE vcsq.vendor_id = vc.vendor_id);
  </code></pre>