Count Service Dates for Patients, Grouped by Rendering Provider

“Any suggestions on how to create a query that would provide a count of the Dates Of Service for each
patient within a specified date range? I would also need either rendering provider or primary.
SELECT
   id, 
   provcode, 
   count(distinct trandate) as SrvDateCount
FROM
   sos.rv_charges
WHERE
   trandate between '2001-01-01' and '2001-03-31'
GROUP BY
   id, 
   provcode
Obviously set the date range correctly. Note that the DISTINCT in this case must be within the parens
with the column you want the distinct count of.

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.