title: Calculating ratio between two similar table columns in SQL Server
body: <p>I have this table </p>
  
  <pre><code>Code1   Month1   Month2   Month3 
  --------------------------------
  Delta    2000     3000     1000
  Charlie  1000     1000     2000
  Bravo     800      200      300
  </code></pre>
  
  <p>and I have another similar temp table with data from a different calculation aspect</p>
  
  <pre><code>Code1     Month1  Month2  Month3 
  --------------------------------
  Delta      1000    3000   3000
  Charlie     300     400    200
  Bravo       400     200    300
  </code></pre>
  
  <p>I was wondering how I can merge data from both tables into one with it being in the following format </p>
  
  <pre><code>Code1      Month1  Month2  Month3 
  ---------------------------------
  Delta   2      ........
  Charlie 3.3    ...
  Bravo   2      ....
  </code></pre>
  
  <p>Which is basically matching the rows and then doing 1st table column / 2nd table column.</p>
  
  <p>A rough approach I have is to just join the table into one big table using and then creating another temp table by dividing the joined columns but was wondering if there is a better approach.</p>
  
  <p>Thanks</p>