Subject Re: [firebird-support] last record from a table
Author Alexandre Benson Smith
Hi !

Em 27/1/2012 17:47, Sergio H. Gonzalez escreveu:
> (Firebird 2.5)
> Hello! this is probably an old question, but didn't find nothing on the
> net...
> Here's a sample table: MyTable (has two fields) = ID: integer& MyDate: Date
> Is this the best (fastest) way to get the LAST inserted record from a table?
> select MyDate from MyTable where id = (select max(id) from MyTable)
> Thanks!!

I would go for:

select first 1 MyDate from MyTable order by ID desc

With a descending index on ID of course.

see you !