title: Bulk SQL insert in Wordpress usermeta table
body: <p>I have an extra table in my Wordpress DB with the structure shown below</p>
  
  <pre><code>CREATE TABLE `rsvp` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uid` int(10) unsigned NOT NULL,
  `came` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `rsvp_id` (`uid`),
  KEY `came` (`came`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  --Other fields edited out for brevity
  --uid here is the same as user_id in the Wordpress usermeta table
  </code></pre>
  
  <p>I would like to create an additional row (meta_key = teamapps, meta_value = 1) in the <code>wp_usermeta</code> table for each user in the <code>rsvp</code> table who has <code>came = "1"</code>.  I only have about 15 entries in the <code>rsvp</code> table  so I could at a pinch simply do a sequence of </p>
  
  <pre><code>INSERT INTO `wp_usermeta` (user_id,meta_key,meta_value) VALUES('uid','teamapps','1');
  </code></pre>
  
  <p>I could also write a simple PHP script to automate the job for me.  However, I am wondering whether there isn't a pure SQL way to do this - query the <code>rsvp</code> table to establish all users who have <code>came = 1</code> and then use the results of that query to do the insert in the <code>wp_usermeta</code> table.</p>
  
  <p>I suspect this can somehow be done via a <code>JOIN</code> but SQL is pretty much my weak suite so I have no idea how I should write the relevant SQL.  Perhaps someone here might be able to help?</p>