Subject Re: [ib-support] Select SQL
Author Ivan Prenosil
> SELECT * FROM TableA WHERE Number IN (SELECT MAX(Number) FROM TableA WHERE
> Number < 1000)

> Select * from tableA where Number in
> (Select Max(Number) from tableA
> where Number < 1000)

Because of using non-correlated scalar subquery,
you get much better plan if you use "=" instead of "IN"
(thanks Ann for explanation).

Also do not forget that Max() can use only Descending index.

Ivan
http://www.volny.cz/iprenosil/interbase