title: Using column aliases in derived selects or views breaks simple select queries
body: <p>I have a genuine use-case which requires referring to column aliases in a "where" clause. I'm trying to use the techniques outlined here, which I expect to work in Sybase and MySQL but don't seem to work in either H2 or HSQLDB:
  <a href="http://databases.aspfaq.com/database/how-do-i-use-a-select-list-alias-in-the-where-or-group-by-clause.html" rel="nofollow">http://databases.aspfaq.com/database/how-do-i-use-a-select-list-alias-in-the-where-or-group-by-clause.html</a></p>
  
  <p>If you'd be kind enough to try and recreate my issue, here's how you can do it:</p>
  
  <pre><code>create table CUSTOMER (code varchar(255), description varchar(255), active bit, accountOpeningDate date, currentBalance numeric(20,6), currentBalanceDigits int)
  insert into CUSTOMER (code, description, active, accountOpeningDate, currentBalance, currentBalanceDigits) values ('BMW', 'BMW Motors', 0, '2011-01-01', 345.66, 2)
  insert into CUSTOMER (code, description, active, accountOpeningDate, currentBalance, currentBalanceDigits) values ('MERC', 'Mercedes Motors', 1, '2012-02-02', 14032, 0)
  </code></pre>
  
  <p>Then, this SQL query fails:</p>
  
  <pre><code>select nest.* from (
    select CODE "id", DESCRIPTION "description",
    ACTIVE "active",
    accountOpeningDate "accountOpeningDate",
    currentBalance "currentBalance"
    from customer
  ) as nest
  where nest.id = 'BMW'
  </code></pre>
  
  <p>It's fine if you strip of the "where nest.id = 'BMW'". However, trying to use any of the aliases in either the where clause or the select clause (nest.id rather than next.*) then the query fails. Error code is Column "NEST.ID" not found; ... [42122-167] 42S22/42122</p>
  
  <p>The same failure occurs if you try and create a view with aliased column names then try and select from the view. For example:</p>
  
  <pre><code>create view customer_view as 
  select CODE "id", DESCRIPTION "description", 
  ACTIVE "active", 
  accountOpeningDate "accountOpeningDate", 
  currentBalance "currentBalance" 
  from customer
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>select id from customer_view
  </code></pre>