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

Query Most Recent Date

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a query written to extract records for customers. When ever a change is made is writes to a new row for record retension. I would like to only receive the most recent date from that column. Can any one help with this scripting????
 
Do you want only the one record with the most recent date, or do you want the record with the most recent date for a specific condition, such as a particular customer?

A) [tt]select top 1 * from MyTable
order by MyDateColumn desc[/tt]

or

B) [tt] select top 1 * from MyTable
where CustomerID = 'MyCustID'
order by MyDateColumn desc[/tt]
Robert Bradley
Sr. DBA, some big company
cheap prints and oil paintings:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top