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!

Query returning only MAX record

Status
Not open for further replies.

kirnavi

Technical User
Feb 4, 2002
29
US
I'm trying to write a query that will return only the record that contains the most recent date. For example, if you had a customer database and a new row is added every time the customer makes an order. Now you'd like to see what everyone's most recent orders are.

I'm sure this is simple, but I've been having problems all day.

Thanks!
 
SELECT * FROM TABLENAME WHERE DATE = (SELECT MAX(DATE) FROM TABLENAME)

something like this should work.


Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top