Question : Records with 1 Distinct field in SQL - Access 2010

Good Morning, I have a bit of a newbie question with SQL. I've been racking my brains trying to figure it out.

I have 2 tables:

DeviceSummary (AssetName, Username, Last Used)
UserDetails (Username, First Name, Last name, Cost Center)

DeviceSummary holds the data for every logon that happened to every PC in the last 3 months.
What I need is to be able to determine just the last user for each unique asset (As there is a lot of duplication on assets due to multiple logins)

I've run a query, this returns all of the entries, but the rows still

SELECT DeviceSummary.AssetName, DeviceSummary.Username, UserDetails.[First name], UserDetails.[Last name], UserDetails.[Cost Centre], DeviceSummary.LastUsed
FROM UserDetails INNER JOIN DeviceSummary ON UserDetails.Username = DeviceSummary.Username
ORDER BY DeviceSummary.LastUsed DESC;

AssetName      Username      First name      Last name      Cost Centre      LastUsed
A880202            cconnell            Chris            Connell            1-00-000            7/29/2010 7:00:00 AM
A880202            dclarke            Derek            Clarke            1-00-000            5/17/2010 11:54:00 AM
A880202            jfitch                  John                  Fitch                  1-00-000            6/17/2010 6:48:00 AM
A880202            dsmart            Dana            Smart            1-00-000            4/28/2010 9:01:00 AM

As you can see it returns multiple logins, but I just need the lastest.

Any ideas?

Answer : Records with 1 Distinct field in SQL - Access 2010

SELECT DeviceSummary.AssetName, DeviceSummary.Username, UserDetails.[First name],
       UserDetails.[Last name], UserDetails.[Cost Centre], DeviceSummary.LastUsed
FROM UserDetails INNER JOIN DeviceSummary ON UserDetails.Username = DeviceSummary.Username
WHERE DeviceSummary.LastUsed = DMax("LastUsed", "DeviceSummary", "AssetName='" & DeviceSummary.AssetName & "'")
ORDER BY DeviceSummary.LastUsed DESC;
Random Solutions  
 
programming4us programming4us