Hello,
I have a query listed below which works but...
The data below is what the query displays. There are hundreds of records I am bringing up and each one has between 3-6 entries displayed in this general format. The LastPFProtocolS tageIndex (level reached) column will always reflect the same number for the patient. Based on the number in the first column I would like the query to display the first duplicate occurance and nothing more.
The overall project is to have a printout of this data to be turned in at the end of each month for clinic stats. Right now I take this nice long list, put it through some excel paces and in a hour or so I can have what I want.
My initial question was if anybody could tell me how to structure the query to display only the first entry of the duplicate series, but if anybody wants to go a bit farther and point out any possibilies for adding a count for the various columns (FVL, DLCO, Pleth) for each that is listed true...
Thank you!
level reached Last Name Date FVL DLCO Pleth Protocol
6 Doe 09/02/08 09:05 AM TRUE FALSE FALSE Pre
6 Doe 09/02/08 09:05 AM TRUE FALSE FALSE Pre
6 Doe 09/02/08 09:05 AM TRUE FALSE FALSE Pre
SELECT PatVisit.LastPF ProtocolStageIn dex, Patient.Patient LastName AS LastName, PatVisit.VisitD ateTime, PatVisit.FVLTes t AS FVL,
PatVisit.DLCOTe st AS DLCO, PatVisit.PlethT est AS PLETH, PFProtocolStage .PFProtocolStag eLabel AS ProtocolState3
FROM PatVisit INNER JOIN
Patient ON PatVisit.Patien tGUID = Patient.Patient GUID INNER JOIN
PFProtocol ON PatVisit.PFProt ocolGUID = PFProtocol.PFPr otocolGUID INNER JOIN
PFProtocolStage ON PFProtocol.PFPr otocolGUID = PFProtocolStage .PFProtocolGUID
ORDER BY PatVisit.VisitD ateTime DESC
I have a query listed below which works but...
The data below is what the query displays. There are hundreds of records I am bringing up and each one has between 3-6 entries displayed in this general format. The LastPFProtocolS tageIndex (level reached) column will always reflect the same number for the patient. Based on the number in the first column I would like the query to display the first duplicate occurance and nothing more.
The overall project is to have a printout of this data to be turned in at the end of each month for clinic stats. Right now I take this nice long list, put it through some excel paces and in a hour or so I can have what I want.
My initial question was if anybody could tell me how to structure the query to display only the first entry of the duplicate series, but if anybody wants to go a bit farther and point out any possibilies for adding a count for the various columns (FVL, DLCO, Pleth) for each that is listed true...
Thank you!
level reached Last Name Date FVL DLCO Pleth Protocol
6 Doe 09/02/08 09:05 AM TRUE FALSE FALSE Pre
6 Doe 09/02/08 09:05 AM TRUE FALSE FALSE Pre
6 Doe 09/02/08 09:05 AM TRUE FALSE FALSE Pre
SELECT PatVisit.LastPF ProtocolStageIn dex, Patient.Patient LastName AS LastName, PatVisit.VisitD ateTime, PatVisit.FVLTes t AS FVL,
PatVisit.DLCOTe st AS DLCO, PatVisit.PlethT est AS PLETH, PFProtocolStage .PFProtocolStag eLabel AS ProtocolState3
FROM PatVisit INNER JOIN
Patient ON PatVisit.Patien tGUID = Patient.Patient GUID INNER JOIN
PFProtocol ON PatVisit.PFProt ocolGUID = PFProtocol.PFPr otocolGUID INNER JOIN
PFProtocolStage ON PFProtocol.PFPr otocolGUID = PFProtocolStage .PFProtocolGUID
ORDER BY PatVisit.VisitD ateTime DESC
Comment