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

Extracting Data using MAX

Status
Not open for further replies.

gazza11

Technical User
Jan 12, 2003
46
0
0
AU
I have an Access 2000 table with an ID, dates and other info. Eg:
ID Date
1 1/1/99
2 2/1/99
3 3/1/99
1 10/6/00
2 11/6/00
2 12/6/00

I need to extract the latest date for each ID but I also need that ID as I use the dataset created in Crystal reports.
My dataset should contain
1 10/6/00
2 12/6/00
3 3/1/99

I used the MAX function to get the latest date but cannot get the ID (Aggregate function error). Can someone please assist me.
 
Hi,

Use the following SQL query:

Select ID, Max (Date)
From Table
Group By ID
Order By ID

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top