Print Page | Close Window

Simple SQL Question

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=12476
Printed Date: 30 March 2026 at 12:10pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Simple SQL Question
Posted By: zaboss
Subject: Simple SQL Question
Date Posted: 08 November 2004 at 9:08am
If I am to select the first or the last record in a table, I would do a SELECT TOP 1  myField... and order them ASC or DESC, depending on which one I want to trigger. But how can I select ALL the records BUT the last one?

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Replies:
Posted By: michael
Date Posted: 08 November 2004 at 9:21am
If you want to show all but the last record it's not really worth the hassle dropping that if you can do it in the application, I'd just not show it in the recordset display...

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: zaboss
Date Posted: 08 November 2004 at 9:35am
Well, the way I see it sounded too complicated, that's why I was after a SQl solution. What do you have in mind?

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web


Posted By: Mart
Date Posted: 08 November 2004 at 9:46am
Well just increment a counter when your looping through the recordset and then something like

If Not MyCounter = rs.RecordCount Then
..
MyCounter += 1
End If



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