title: How to create table and insert values in one statement
body: <p>I have been given the task to create a statement, which creates a table and then inserts values from a join of two different tables.</p>
  
  <p>This is a hideous task, just to feed a small application with data, because it can't deal with views (and SQL server for that part)</p>
  
  <p>Which brings me, to my CREATE statement:</p>
  
  <pre><code>CREATE TABLE resultstable1_DIFF (
  [Id] Counter Primary key not null,
  [km] number,
  [Diff] float) 
  </code></pre>
  
  <p>And the INSERT Statement</p>
  
  <pre><code>Insert Into resultstable1_DIFF(km, Diff)
  SELECT Round(A.km, 4), Round(X.y - A.y, 4)
  FROM sourcetable_1_HQ100 as A INNER JOIN sourcetable_2 as X
  ON Round(A.km, 4)  = Round(X.km, 4)
  </code></pre>
  
  <p>Unfortunatly UNION does not work here. Can somebody point me into the right direction? It is my goal, to create a loop for some 50-ish source table pairs.</p>
  
  <p>If a VBA macro would result in a more elegant and reusable solution, it is fine by me.</p>
  
  <p>Kind regards.</p>