Subject | Re: [firebird-support] last record from a table |
---|---|
Author | Alexandre Benson Smith |
Post date | 2012-01-27T20:20:18Z |
Hi !
Em 27/1/2012 17:47, Sergio H. Gonzalez escreveu:
select first 1 MyDate from MyTable order by ID desc
With a descending index on ID of course.
see you !
Em 27/1/2012 17:47, Sergio H. Gonzalez escreveu:
> (Firebird 2.5)I would go for:
>
> 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!!
>
select first 1 MyDate from MyTable order by ID desc
With a descending index on ID of course.
see you !