var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Access 2010 - Query Latest Time for Each Unique User
I have a simple database, three fields.
Username contains multiple entries for the same user, Date contains multiple duplicates, Time contains unique entries within the scope of each user.
I need to query so that I will end up with the latest time record for each user.
If I simply do SELECT MAX it will only give me the latest time, not the latest time for each user.
Is there a simple way to do this?
By the way, using reserved words (Date, Time) for naming columns in a table is not a good idea. One can even say that it's looking for trouble in your application, sooner or later.
SELECT [Table].[UserName], Max([Table].[Date]+[Table].[Time]) AS LatestTime
GROUP BY [Table].[UserName]
ORDER BY Max([Table].[Date]+[Table].[Time]);
Have a nice day!
Thanks, I'll give that a shot.
The fields are actually named Date-Time1 and Date-Time2 but I simplified for the sake of clarity.
The solution worked perfectly, although for some reason it only exports the Date to Excel and strips the time, but I'm not so bothered about that, I only need the date.
Last edited by HeretiCorp; 02-15-11 at 12:09.