Select date of last visit

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My table includes "name" and "date of visit" fields. Some people may have multiple records depending on their number of visits. How do I write a query to select only the last "date of visit" so that I end up with only one record per person

Thanks!
 
I have a similar issue. the solution here does not work. I get an error
message that states the first field in my query is not part of an aggregate
function.

In my example, I have a list of assignments made to employees. I would like
to see when the last assignmetn was given to each employee so I will know
who should get the next ones to come through. My table contains (among
others) UserID and DateAssigned. I used the example below to build the
query...

SELECT UserID, max(DateAssigned)
FROM tblAssignments;

I get the error:

"You tried to exceute a query that does not include the specified expression
'UserID' as part of an aggregate function."

Any suggestions?


Rick



Dale said:
Maybe try something like SELECT LastName, FirstName, MAX(DateOfVisit)
FROM ...
have multiple records depending on their number of visits. How do I write a
query to select only the last "date of visit" so that I end up with only one
record per person?
 
I see what you mean ... sorry to mislead you. I guess because Max is a
summary function. Hopefully someone has some suggestions.
 
Back
Top