title: Referencing a calculated column in the where clause SQL
body: <p>This line of code is a snippet from my select statement.</p>
  
  <pre><code>frdFreedays - DateDiff(dd,conReceiptToStock,GetDate()) As FreeDaysRemaining
  </code></pre>
  
  <p>Below is a snippet from my where clause</p>
  
  <pre><code>and frdFreedays - DateDiff(dd,conReceiptToStock,GetDate()) &lt;= @intFreeDays
  </code></pre>
  
  <p>The question I have is how can I reference the FreeDaysRemaining column and so I can compare it to @<code>intFreeDays</code></p>
  
  <p>I am looking for something like this</p>
  
  <pre><code>Freedays &lt;= @intFreeDays
  </code></pre>