title: MYSQL insert into single table using the results of two different tables
body: <p>Hello to whomever wishes to bite his teeth on this,</p>
  
  <p>I came across multiple examples of how to use the result set of subquery select into another table.
  What I have however is:</p>
  
  <pre><code>SELECT `klanten_zakelijk`.`bedrijfs_id`, `klanten`.`klant_id` 
      FROM `klanten`,`klanten_zakelijk`
      WHERE `klanten`.`emailadres` = '$email' 
      AND `klanten_zakelijk`.`bedrijfs_kvk`='$kvknr'
  </code></pre>
  
  <p>As you can see I take the results from two different tables and need to port them to another table.</p>
  
  <p>I wish to insert those values into the table <code>klant_bedrijf_machtiging</code>.</p>
  
  <pre><code>INSERT INTO `klant_bedrijf_machtiging` (`klant_id`, `bedrijfs_id`, `machtiging`) VALUES ('8501', '1', '3');
  </code></pre>
  
  <p>The column <code>machtiging</code> is is standard 3 with an insert but I need to be able to change that as well to 1 if the company already exists, but I will intercept that at another part of my code.</p>
  
  <p>All the examples I saw were just the results from one table being imported into anther table.
  Does that same logic apply when you take results from two tables? If so, what would be the wisest and most efficient way to implement this?</p>
  
  <p>So to make the question short:
  How do I get <code>bedrijfs_id</code> and <code>klant_id</code> into the corresponding columns into <code>klant_bedrijf_machtiging</code> whilst still myself being able to manipulate the last column <code>machtiging</code> in just 1 query.</p>