Site icon SOS Resources

Patient List by Rendering Provider

Here is a query that will show the patient on the list for every provider who ever provided services for
that patient (so that patient could show up on multiple lists). The output is sorted by rendering provider,
but there are no page breaks or other fancy stuff.
SELECT DISTINCT
   d.provcode,
   a.lastname, 
   a.firstname, 
   a.id
FROM
   sos.patients a 
   JOIN sos.journal b 
   JOIN sos.jcharges c 
   JOIN sos.providers d
WHERE
   a.flag = 0
GROUP BY
   provcode,
   lastname, 
   firstname, 
   id
ORDER BY
   provcode, 
   lastname, 
   firstname, 
   id
"a.flag = 0" restricts the output to active patients
If you wanted to output a single provider you would add this on the line below "a.flag"
AND d.provcode = 'ABC'
Exit mobile version