title: Dynamic/Conditional SQL Join?
body: <p>I have data in a MSSQL table (TableB) where [dbo].tableB.myColumn changes format after a certain date... </p>
  
  <p>I'm doing a simple Join to that table.. </p>
  
  <pre><code>Select [dbo].tableB.theColumnINeed from [dbo].tableA 
  left outer join [dbo].tableB on [dbo].tableA.myColumn = [dbo].tableB.myColumn
  </code></pre>
  
  <p>However, I need to join, using different formatting, based on a date column in Table A ([dbo].tableA.myDateColumn).  </p>
  
  <p>Something like... </p>
  
  <pre><code>Select [dbo].tableB.theColumnINeed from [dbo].tableA 
  left outer join [dbo].tableB on [dbo].tableA.myColumn = 
      IF [dbo].tableA.myDateColumn &gt; '1/1/2009'
          BEGIN
              FormatColumnOneWay([dbo].tableB.myColumn)
          END
      ELSE
          BEGIN
              FormatColumnAnotherWay([dbo].tableB.myColumn)
          END
  </code></pre>
  
  <p>I'm wondering if there's a way to do this.. or a better way I'm not thinking of to approach this.. </p>