title: How do I avoid a repetitive subquery JOIN in SQL?
body: <p>In SQL Server 2008:</p>
  
  <p>I have one table, and I want to do something along the following lines:</p>
  
  <pre><code>SELECT T1.stuff, T2.morestuff from
  (
   SELECT code, date1, date2 from Table
  ) as T1
  INNER JOIN
  (
   SELECT code, date1, date2 from Table
  ) as T2
  
  ON T1.code = T2.code and  T1.date1 = T2.date2
  </code></pre>
  
  <p>The two subqueries are exactly identical. Is there any way I can do this without repeating the subquery script?</p>
  
  <p>Thanks</p>
  
  <p>Karl</p>