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

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
table.field1.

Ciao
--
Nando Dessena
mailto:nandod@...
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================