title: sql query join multiple tables on a case when column
body: <p>i have sql like this:</p>
  
  <pre><code>select case when.....end as colA, table2.col3
  from table1
  join table2 on table2.colB = colA
  </code></pre>
  
  <p>in the case when statement, there are some other tables columns, is this doable? I have got error saying that colA is not valid.</p>