Don't forget to have an index if possible to attempt to reduce table access.
--
Bob
Consulting I/T Specialist
IBM Toronto Lab
IBM Software Services for Data Management
[My comments are solely my own and are not meant to represent an official IBM position - ask my cat!]
"Mark A" <ma@switchboard.net> wrote in message news:jL******************@news.uswest.net...
"Ricardo" <r_********@yahoo.com> wrote in message
news:ab**************************@posting.google.c om...
Hi all,
I am trying to come up with a sql query (just one query) that returns
all the columns for the last N records that were inserted into a
table. I have a column in the table that has the creation timestamp
for each record. In other words, if a client requests to get only the
latest 5 records, then this query shoud exactly do that: get all the
columns for the last 5 records that were inserted into the table.
ORDER BY the creation timestamp column in DESCENDING sequence. Then use the
FIRST n ROWS ONLY clause.