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

select distinct max

  • Thread starter Thread starter -
  • Start date Start date
Status
Not open for further replies.

Guest
I have a table with 3 columns, clientID, salesID and date with data such as
10001,1,5/20/2001
10001,2,5/22/2001
10001,3,5/21/2001
10002,2,5/24/2001
10002,3,5/25/2001
etc
How do I select distinct clientID so that the one selected has the max date? that is, I need the result:
10001,2,5/22/2001
10002,3,5/25/2001
etc
Many thanks
 
SELECT DISTINCT clientID, max(date)
FROM Table
GROUP BY clientID
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top