Subject Re: [firebird-support] Select First
Author Milan Babuskov
gorepj wrote:
> Why does the following query return all rows and not just two rows?

Because you seleced all rows ;) (in the most-outer query)
>
> SELECT MyField FROM MyTable where MyField in (Select first 2 MyField
> from MyTable)
>
> This might seem a strange thing to want to do but not so when the
> two tables are different.

It's because the select inside IN is evaluated for each row. Your query
may not even return all rows, since you didn't specify any ORDER BY
clause, the results are unpredictable.

Try telling us what you really wanted to do, and what that query looks
like, so we could give you some hints.

--
Milan Babuskov
http://fbexport.sourceforge.net