title: MySQL Join with Insert combined?
body: <p>Is it possible to have an INSERT from a reference table if something exists there?</p>
  
  <p>Say this is the query to insert some data...</p>
  
  <pre><code>INSERT INTO  `Test`.`Items` (
  `Name` ,
  `Type` ,
  `Number`
  )
  VALUES (
  'Pork',  'Sausage', 6
  );
  </code></pre>
  
  <p>And that I have a lookup table called "Lookup" that contains two columns.  "Type" and "Number".  What I want is that if something exists in the "Lookup" table in this instance for Type Sausage then to pull in the "Number" field from the lookup table instead of inserting the 6 in the INSERT statement.</p>
  
  <p><img src="https://i.stack.imgur.com/6UeDe.png" alt="enter image description here"></p>
  
  <p>Hope that is clear!</p>