Avatar of bfuchs
Flag for United States of America

asked on 

Pure SQL question

Hi Experts,

I have a table named PatientsCertificationPeriods_HC with the following columns

ID- auto number
PatientID- int
Subject - varchar
FromDate - DateTime

Now I need to get a list out of each patient, one record with subject 'SOC' and two records with subject "WG Recert", those two records should be the last two according to FromDate column.

(The SOC I want regardless of date, as there should not be more then one SOC per patient).

How can I accomplish that?

This can be done with either T-Sql or Access query.
Microsoft AccessMicrosoft SQL ServerSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon