title: If Else Statement within an inner join
body: <p>I have a table jobs with a column StartDate that is often null. If it is not null this is what I want to inner join with a table quarters on, otherwise I want to inner join on some other conditions. This is sort of what I want:</p>
  
  <pre><code>INNER JOIN Quarters q
  ON  (IF j.StartDate IS NOT NULL (j. StartDate BETWEEN GETDATE() and q.EndDate)
       ELSE **Some other condition**)
  </code></pre>
  
  <p>The error that comes up when this is run is that there is incorrect syntax near the keyword 'IF' </p>
  
  <p>Does anyone know the correct syntax for this?</p>
  
  <p>Thanks in advance for your help!</p>