Subject Re: [firebird-support] "First N" ignored within subselect???
Author Thomas Steinmaurer
> I just ran into something bizarre.
>
> The following query:
>
> select first 10 custkey from customer where ....
>
> returns 10 rows, as I'd expect. However, if I put that in a subselect, like:
>
> select custkey from customer where custkey in
> (select first 10 custkey from customer where ....)
>
> This one returns 48 rows. Custkey is the primary key on the Customer table, so there can't be more than one customer with the same custkey.
>
> So, it appears that when when the "first n" is within a subselect, it is ignored, as far as I can tell.
>
> Is this a bug in Firebird? Or is there some legitimate reason that it was designed that way?
>
> I am running Firebird 1.0 if that affects the answer.

Yes. A known issue. Therefore support for the ROWS syntax has been added
in 2.1, which can be safely used in sub-queries as well.



--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com
My blog:
http://blog.upscene.com/thomas/