this will also work, at least for sql 2k it does


set rowcount  5
select * from table_name order by id desc
set rowcount 0

-----Original Message-----
From: Steve Brownlee [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 30, 2004 1:51 PM
To: CF-Talk
Subject: RE: last 5 entries of query

Would this do it?

SELECT TOP 5 * FROM table_name
WHERE table_name.id_field =
(
SELECT table_name.id_field FROM table_name ORDER BY table_name.id_field DESC
)

________________________________

From: Mark Henderson [mailto:[EMAIL PROTECTED]

I'm just wondering if there is an easier way to display only the the last 5
entries of a query without having to use, in my case, max(id) and then
subtracting 5. This means I have to do a couple of queries to get the
resulting output and I thought it might be possible to do everything inside
the one query.
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to