title: SQL Server SELECT Query using "CASE... END" to select column but getting Column not found error
body: <p>I have onse SELECT statement to get distinct row and in which I have used "CASE" to get return column data from different table. But, some how in result it's not giving particualar column. Please see below sample query.</p>
  
  <pre><code>SELECT DISTINCT
      T1.Col1,
      T2.Col2,
      CASE WHEN &lt;My Condition &gt; THEN T1.IncomeColumn
      ELSE
       T2.IncomeColumn
      END AS FinalIncome
  FROM Table1 as t1  inner join Table2 as T2 on T1.ID = T2.ID
  </code></pre>
  
  <p>Here, as per above example If I am trying to user results of the query it's throwing "FinalIncome" Column not found error.</p>
  
  <p>I have very lrge and time consuming to get result of this query so, it's difficult to get quick root cause. </p>
  
  <p>please let me know if anyone have idea that what are the possibilties for this issue.</p>
  
  <p>Thanks in advance.</p>