Subject Re: Sub-Query Problem
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "Alfred Seetoh"
<cwseetoh@s...> wrote:
> I wanted to retrieve 10 records starting from the 20th position, so
I
> wrote:
>
> SELECT FIRST(10)
> FROM ( SELECT SKIP(20) FROM CUSTOMER )
>
> I got the following error msg:
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 2, char 8.
> select.
>
> Subsequently I found out that firebird doesn't really support sub-
> queries, cos I got similar msg when I do the following:
>
> SELECT *
> FROM ( SELECT * FROM CUSTOMER )
>
> Can somebody confirm me on this? Thanks.

Alfred, this can confirm IB6 Open Source Language Reference where
syntax of SQL dialect used in FB is described. Note IB6 docs are
generally legal for FB, differences are described in Release Notes for
particular FB version. But there is terminological nuance - what we
call sub-query? If SELECT FROM SELECT - FB don't support this. If
constructions like

Select T1.A, (Select T2.B From T2)
From T1

Or

Select T1.A
Where T1.B=(Select T2.B From T2)

- they are legal for FB.

Looking on your initial query I suspect you really want something
like

SELECT FIRST(10) SKIP(20) * FROM CUSTOMER

Am I wrong?

Best regards,
Alexander.