title: Is it possible to select column based on previous column case
body: <p>I need to group my customers into say 3 groups according on their postal ZIP code.</p>
  
  <p>In the customer DB there is 2 fields that can contain the ZIP code.</p>
  
  <p>Street Address Zip is primary and Postal Address is used if the user did not enter Zip for the street address.</p>
  
  <p>Some times both are NULL and it is possible illegal values has been input.</p>
  
  <p>So I first need to get the ZIP with a Case statement:</p>
  
  <p>case 
  when streetAddress.zip IS not NULL and streetAddress.zip between '0' and '99999' then streetAddress.zip
  when postalAddress.zip IS not NULL and postalAddress.zip between '0' and '99999' then postalAddress.zip
  else NULL end 
  )'PostCode',</p>
  
  <p>But now I want in the next column to select based on 'PostCode' but it seems it is not possible to use the value from previous column.</p>
  
  <p>Somthing like
  case 
  when PostCode is between '00000' and '33333' then 'Zone1'
  when PostCode is between '33334' and '66666' then 'Zone2'
  when PostCode is between '66669' and '99999' then 'Zone3'
  end</p>
  
  <p>In the end I am trying to make a view that then would hold the PostCode and Zone value.</p>