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

how to get latest date data set!

Status
Not open for further replies.

choohean

Technical User
Jan 15, 2002
57
MY
I have store several data including date into the database...The date format that I'm using is 4/26/2002! How do I can get the data set with the condition is the latest date???

Hope that are anyone to give me a hand...!
 
Consider the table myTable with 1 column myDateCol..

SELECT *
FROM myTable
WHERE myDateCol = (SELECT DISTINCT TOP 1 myDateCol
FROM myTable
ORDER BY myDateCol DESC)

This query will give you the records which have the latest date in myDateCol.

Hope this helps :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top