Oracle 8.1.7:

select a, (select c  from (select d + 1 as c from dual) ) as d
 from (select 1 as a, 2 as b from dual) 

ORA-00904: invalid column name

If you replace (d + 1) with a number this query runs fine.

Perhaps it isn't a valid correlated subquery.
Anyone know the SQL spec well enough to comment?

--- Alexander Kozlovsky <[EMAIL PROTECTED]> wrote:

> > Does these queries work on other databases?
> 
> I can test only MS SQL Server today, and the original query generates
> error. IMHO, the bug is in both SQLite and MS SQL Server :)
> 
> > Are they valid correlated subqueries?
> 
> I think, yes.
> 
> -----------------------------------------------------------------
> 
> Put my initial question another way, I think this is correct SQL:
> 
>   select (
>       select a
>       from (select a
>             from (select a
>                   from (select a
>                         from (select a
>                               from (select b as a) as T1
>                              ) as T2
>                        ) as T3
>                  ) as T4
>            ) as T5
>       ) as column_1
>   from (select 1 as b) as T0
> 
> It is certainly weird, but it is correct. But SQLite
> generate error
> 
> -- 
> Best regards,
>  Alexander                  mailto:[EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to