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

Recent SQL Date Question 1

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
US
How do I write an SQL statement to get the most recent date? Is Max date an option?

Thanx much,
Trudye

 
select Max(DateField) from Tablename

will give you the most recent date entered in this field.


If you need additional fields, you must also include them in a GROUP BY Statement:

SELECT USERNAME, MAX(DateField) FROM TableName GROUP BY USERNAME





Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
And what have you tried to far? Some code please and an explanation of why it didn't return the values you expected, along with same sample data.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Thanx Paul. I had no idea what to use so I decided to ask. I couldn't find anytning on it in the book that I have.

Thanx again,
Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top