...how to filter/query records

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

Guest

i have a table with 20,000 records. one column includes names. another column
includes multiple dates the person visited a doctor, and another column
includes dates the person visited a hospital. i am only interested in the
last date the person visited a doctor and the last date the person visited a
hospital (if they had any visits to the doctor or hospital). I am also
interested in members who have had no visits to the doctor or hospital. any
suggestions on how i can filter the data to only return these records? thanks


Name Date Visited Doctor Date Visited Hospital
Nigel 01/01/1980 012/31/1995
05/20/1999 06/06/2005
03//02/2004 05/06/2004



For example, I only want to return

Nigel, 03/02/2004 (Date Visited Doctor), and 06/06/2005 (Date Visited
Hospital). thank you. i really appreciate any help you can offer.
 
SELECT PatientVisit.Name, Max(PatientVisit.DoctorVisit) AS Doctor,
Max(PatientVisit.HospitalVisit) AS Hospitial
FROM PatientVisit
GROUP BY PatientVisit.Name;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top