I need a report that lists by rendering provider the names of any patients who had a service by that provider—and I need to set the date parameters and choose the therapist I want that info on.
Here’s the query, which is easy enough. Just adjust the conditions in the WHERE clause
for the desired date range and provider codes.
SELECT
DISTINCT pr.provcode, pt.lastname, pt.firstname, pt.id
FROM
sos.providers pr
JOIN sos.jcharges jc ON pr.providernum = jc.providernum
JOIN sos.journal jou ON jc.jnum = jou.jnum
JOIN sos.patients pt ON jou.ptnum = pt.ptnum
WHERE
jou.trandate BETWEEN '2010-01-01' AND '2010-12-31'
AND pr.provcode IN ('VB1','VB2','VB3')
ORDER BY
pr.provcode, pt.lastname, pt.firstname, pt.id