Patients With Specified Diagnosis, Intake Date, And Last Date of Service

I want to see a list of clients bearing a certain diagnosis, along with their intake date, each of their four diagnoses, and last date of service.

SELECT
  Providers. ProvCode, Providers.ProvLName, Providers.ProvFName,
  Patients.LastName, Patients.FirstName, Patients.IntakeDate,
  PtVars.LFeeDate AS "Last Service",
  PtCSUDx.DxCode1, PtCSUDx.DxCode2, PTCSUDx.DxCode3, PtCSUDx.DxCode4  
FROM
  sos.Patients
  LEFT OUTER JOIN sos.Providers ON Patients.ProviderNum = Providers.ProviderNum
  LEFT OUTER JOIN sos.PtCSU ON Patients.PtNum = PtCSU.PtNum
  LEFT OUTER JOIN sos.PtCSUDx ON PtCSU.PtCSUNum = PtCSUDx.PtCSUNum  
  LEFT OUTER JOIN sos.PtVars ON Patients.PtNum = PtVars.PtNum  
WHERE
  Patients.LicNum = 101 AND
  PtCSU.TypeFlag = 'D' AND
  PtCSUDx.DxCode1 = '300.14'   /*<-- desired Dx code goes here*/
ORDER BY
  Providers.ProvCode, Patients.LastName

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.