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

sql

Status
Not open for further replies.

dpaulson

Programmer
Joined
May 7, 2000
Messages
347
Location
CA
I am stuck on creating a sql for an access database.
I have a table named GLTransactions. It has a couple of fields named GLAmount and GLTransDate. What would the sql that I would use to get the value of GLAmount from the transaction that has latest GLTransDate.

David Paulson

 
I've got it. I am using - select top 1 GLTransDate, GLTransAmount FROM GLTransactions



David Paulson

 
Don't forget that (in general) a SQL SELECT statement fetches the rows in no particular order, so you may need to add an ORDER BY clause
Code:
select top 1 GLTransDate, GLTransAmount FROM GLTransactions ORDER BY GLTransDate DESC

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top