Formatting code for PatientsByRenderingProvider


show source only

======Patients By Rendering Provider======

Back to [[QueryDirectory Query Directory]]

//
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.

%%(sql)
SELECT
DISTINCT pr.provcode, pt.lastname, pt.firstname, pt.id
FROM
providers pr
JOIN jcharges jc ON pr.providernum = jc.providernum
JOIN journal jou ON jc.jnum = jou.jnum
JOIN 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
%%


----
CategoryQueries
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki