[ 
https://issues.apache.org/jira/browse/DERBY-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526876
 ] 

Bryan Pendleton commented on DERBY-3066:
----------------------------------------

I agree, this is a duplicate of DERBY-84.

Furthermore, I agree with Jack Klebanoff's comment in DERBY-84 that this is not 
a bug (https://issues.apache.org/jira/browse/DERBY-84#action_66872).

W.R.T. DERBY-2998, I think that the nested select construction of row_number() 
restrictions is the form that should be used.


> WHERE clause not accepted on derived expression columns
> -------------------------------------------------------
>
>                 Key: DERBY-3066
>                 URL: https://issues.apache.org/jira/browse/DERBY-3066
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Thomas Nielsen
>            Priority: Minor
>
> A very simple query involving an expression column with a derived name in the 
> WHERE clause fails:
> ij> select a+b as s from t where s > 2;
> ERROR 42X04: Column 'S' is either not in any table in the FROM list or 
> appears within a join specification and is outside the scope of the join 
> specification or appears in a HAVING clause and is not in the GROUP BY list. 
> If this is a CREATE or ALTER TABLE  statement then 'S' is not a column in the 
> target table.
> Noticed this while working on DERBY-2998, and AFAIK this is a valid query and 
> a limitation in derby.
> There is a workaround for this using a nested select (output from a test 
> table):
> ij> select * from (select a+b as s from t) as t(s) where s > 2;
> S          
> -----------
> 10         
> 10         
> 10         
> 3 rows selected

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to