Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Finding the last but one record

Author  Topic 

gmaddockgreene04
Starting Member

3 Posts

Posted - 2008-05-28 : 16:59:30
Hi SQL Team people!!

I am very new to SQL but looking forward to learning. My problem firstly is trying to extract the last but one (penultimate) record from my News article table.

I have three recordsets established to pull out the last but one, last but two and last but three record.

SELECT *
FROM News
ORDER BY newsID DESC

What do I add to achieve the required result?

Any help or pointers really appreciated.

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2008-05-29 : 03:29:26
you will need to incorporate either the TOP x command or use the SET ROWCOUNT x clause.
search here for other example to solutions to this problem...maybe start with Kristen's FAQ accessible in the SQL for Starters forum.
Go to Top of Page

gmaddockgreene04
Starting Member

3 Posts

Posted - 2008-05-29 : 06:23:41
Thank you Andrew for the pointer. I will investigate.
Go to Top of Page

gmaddockgreene04
Starting Member

3 Posts

Posted - 2008-05-29 : 08:57:21
Well not having much luck here i'm afraid. The TOP command doesn't achieve what I need to do - select a specific row of data, and correct me if I'm wrong but isn't ROWCOUNT not available in MS Access SQL?

I thinking perhaps Access is going to be the restraining db here.
Go to Top of Page
   

- Advertisement -