Subject Re: [firebird-support] Last N records added to a table?
Author Hans
Maybe with two queries:

SELECT COUNT(*) FROM MESA INTO :TOTALROWS

SELECT FIRST N SKIP (TOTALROWS-N) FROM MESA ORDER BY CREATED

In a procedure or two VCL controls

----- Original Message -----
From: "Clay Shannon" <cshannon@...>
To: <firebird-support@yahoogroups.com>
Sent: Thursday, June 09, 2005 2:19 PM
Subject: RE: [firebird-support] Last N records added to a table?


> <<I have newly created table with no records, but will grow with time
> and then I will need to obtain the last N records added to it, in the
> order in which they where added.
>
> I appreciate any solutions or ideas. Currently using FB 1.5.2.>>
>
> How about:
>
> SELECT FIRST N FROM MESA
> ORDER BY CREATED DESC
>
> (where "created" is a timestamp column)
>
> ?
>
> Clay Shannon,
> Dimension 4 Software
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
>