title: How to use a CTE in a left outer join?
body: <p>I am trying to join a common table expression to an existing table (table1) as follows.</p>
  
  <pre><code>select column1, column2 from table1
  
  left outer join
  
    ;with cte as (
      select column1, column2 from table2)
  
    select column1, column2 from cte
  
  on table1.column1 = cte.column1
  </code></pre>
  
  <p>The errors are:</p>
  
  <ol>
  <li>Incorrect syntax near ';'. </li>
  <li>Incorrect syntax near the keyword 'on'.</li>
  </ol>
  
  <p>What am I doing wrong? Should I be using a CTE for this task?</p>