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!

filtering for the largest values

Status
Not open for further replies.

needmoremoney

Technical User
Mar 30, 2005
123
0
0
US
I have a query to filter a from a few tables like the below

Datetime Company Id Person
04/04/06 1:00:00PM 123 34 Emily
04/05/06 9:00:00PM 123 34 Emily
04/05/06 2:00:00PM 123 34 Emily
04/05/06 3:00:00PM 322 34 Emily
04/05/06 3:20:00PM 322 34 Emily
04/06/06 2:20:00PM 212 12 John
04/06/06 3:19:00PM 212 12 John
04/08/06 2:11:00PM 565 12 John
04/05/06 3:54:00PM 565 12 John

I would like it like this.

Datetime Company Id Person
04/05/06 9:00:00PM 123 34 Emily
04/05/06 3:20:00PM 322 34 Emily
04/06/06 3:19:00PM 212 12 John
04/05/06 3:54:00PM 565 12 John

I need to have the query pull the largest date and time for each company. Let me know if you have any ideas.

thanks
 
Just one
Code:
Select MAX(DateTime) As [Latest Time],
       Company, ID, Person

From myTable

Group By Company, ID, Person

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Switch to SQL view; paste the above in and then switch back to design view and Access will show you.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Oh ... and change "myTable" to your correct table name.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top