title: Insert using LEFT JOIN and INNER JOIN
body: <p>Hey all i am trying to figure out how to go about inserting a new record using the following query:</p>
  
  <pre><code>SELECT user.id, user.name, user.username, user.email, 
    IF(user.opted_in = 0, 'NO', 'YES') AS optedIn  
  FROM 
    user
    LEFT JOIN user_permission AS userPerm ON user.id = userPerm.user_id
  ORDER BY user.id;
  </code></pre>
  
  <p>My <code>INSERT</code> query so far is this:</p>
  
  <pre><code>INSERT INTO user 
  SELECT * 
  FROM user 
    LEFT JOIN user_permission AS userPerm ON user.id = userPerm.user_id;
  </code></pre>
  
  <p>However, i  am not sure how to do <code>VALUE('','','','', etc etc)</code> when using left and inner joins.</p>
  
  <p>So what i am looking to do is this:</p>
  
  <p><code>User</code> table:</p>
  
  <pre><code>id    | name       | username    | password                 | OptIn
  --------------------------------------------------------------------
  562     Bob Barker   bBarker       BBarker@priceisright.com   1
  </code></pre>
  
  <p>And also the <code>user_permission</code> table</p>
  
  <pre><code>user_id   | Permission_id
  -------------------------
  562         4
  </code></pre>
  
  <p><strong>UPDATE</strong>
  So like this?</p>
  
  <pre><code>INSERT INTO user (name, username, password, email, opted_in) VALUES ('Bbarker','Bbarker','blahblahblah','Bbarker@priceisright.com',0);
  INSERT INTO user_permission (user_id, permission_id) VALUES (LAST_INSERT_ID(),4);
  </code></pre>