Subject Re: [firebird-support] Simple question
Author Nando Dessena

j> Is it possible to optimize this query:

j> select
j>         field2
j> from
j>         table
j> where
j>         field1 = ( select max(field1) from table )

if you know that you are going to always get at most one record back
then you can try

select first 1 field2
from table
order by field1 desc

otherwise keep yours. Both would benefit from a DESCENDING index on

Nando Dessena
I support Firebird, I am a Firebird Foundation member!
Join today at