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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL to select the last record?

Status
Not open for further replies.

hisham

IS-IT--Management
Nov 6, 2000
194
how can i use SQL to select the last record?
i have: SELECT [name]FROM contact;
I need to Enter criteria in the query to retrieve the last record.
Thanks for help
 
Just like this:
SELECT Last([YourTableName].[YourFieldName}) AS LastOne
FROM [YourTableName];

When you are in a QBE view, depress the totals button on your toolbar, then in your field for "Name", select on the grid in "Totals": Last. You may want to verify this depending which "Last" record you actually want. Optionally if you just want the guy who's named Z.Zed, you could sort your name field descending and in the "top values" combo on the toolbar, enter 1. Good luck,
Gord
ghubbell@total.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top