Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Last Record in a Table 1

Status
Not open for further replies.

mikemcginty

Programmer
Jul 11, 2002
184
0
0
AU
If SELECT TOP 1 returns the first record in a table, how do you return the last record in a table?

Thanks

Mike

When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!
 
Simple...change the order by clause

SELECT TOP 1 from yourtable ORDER BY recordID Asc

will give you the first record

AND

SELECT TOP 1 from yourtable ORDER BY recordID DESC

Will give you the last record


-VJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top