Print Page | Close Window

selecting the last 5 records from DB

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=4177
Printed Date: 28 March 2026 at 7:54am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: selecting the last 5 records from DB
Posted By: zMaestro
Subject: selecting the last 5 records from DB
Date Posted: 10 July 2003 at 5:38am

How can I select the last 5 records from a database?

I want to make an active user monitor, which writes the name of the last 5 users logged...

Thanks




Replies:
Posted By: Gullanian
Date Posted: 10 July 2003 at 6:02am
SELECT TOP 5 * from tblActiveUser ORDER BY loggedinTimewhateverthefieldiscalled ASC


Posted By: MorningZ
Date Posted: 10 July 2003 at 10:09am

actually, that'll get the first 5 not the last five...

replace "ASC" by "DESC"



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Gullanian
Date Posted: 10 July 2003 at 5:56pm
hehe, I always get my ASC and DESC mixed up!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net