Max query returning more info (1 Viewer)

Pienuts

Registered User.
Local time
Today, 09:52
Joined
May 2, 2014
Messages
106
Hi, all;
I have two tables:

tblSITE and tblUSID (joined by SITEID)

and I am trying to create a query which lists each site and the USID with the latest date in its ConstructionDate field (USID and ConstructionDate are both in tblUSID).

If I omit the USID from the query and run a totals with MAX on the ConstructionDate field, I return what I would like to, but I want to add the PK (USID) of the record with the latest ConstructionDate for another query, and every way I attempt it the query returns multiple records per SiteID.

I feel like I'm missing something ridiculously easy, so any help would stop me from having an aneurism this morning!\
Thanks!
 

plog

Banishment Pending
Local time
Today, 10:52
Joined
May 11, 2011
Messages
11,658
Have to be pedantic here--the only way to achieve the results you want in one query* is by using a Dlookup/Dmax call which is inefficient compared to the method you are currently using.

*I count queries by SELECT clauses. Nest them all you want in an Access Query Object, but the amount of queries is defined by how many SELECT clauses it contains.
 

Pienuts

Registered User.
Local time
Today, 09:52
Joined
May 2, 2014
Messages
106
Okay, perfect - that's all I needed to know!
 

Users who are viewing this thread

Top Bottom