Show only last appointment date

  • Thread starter Thread starter Thomas Wright
  • Start date Start date
T

Thomas Wright

In a query with the following fields

PatientNumber FirstName LastName DoctorVisit

I want to show only the records with the most recent DoctorVisit.

Any thoughts?

Tom Wright
 
Dear Thomas:

A query like this should give you what you want:

SELECT PatientNumber, MAX(DoctorVisit) AS MostRecentVisit
FROM YourTable
GROUP BY PatientNumber

Change YourTable above to the actual name of your table.

Now, you asked about getting this from your query, in which you have
added FirstName and LastName. Presumably, these columns come from
some other table, based on PatientNumber. You could add them to the
above query, change from YourTable to YourQuery, and group by them as
well. My preference would be to JOIN to the table containing those
columns after the above query. It's mostly a matter of style.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
create another query that has only PatientNumber and Max(DoctorVisit)
put this query and the table below in a second query, then inner join
by PatientNumber DoctorVisit
HTH
Pachydermitis
 
Back
Top