Patients Seen In Period With Insurance And Provider

Is there a query that will list all clients that were seen in a certain time frame along with name of insurance for a specific provider?

Adjust the desired date range and provider code in the WHERE clause below.

SELECT DISTINCT
  a.lastname,
  a.firstname,
  a.id,
  a.provcode,
  (IF c.payortype = 'I' THEN c.payorname ELSE '' ENDIF) AS "Insurance"
FROM
  sos.rv_charges a
  JOIN sos.ptpayors b ON a.ptpayornum = b.ptpayornum
  JOIN sos.payors c ON b.payornum = c.payornum
WHERE
  trandate BETWEEN '2002-01-01' AND '2002-01-31'
  AND a.provcode = '3'
ORDER BY
  a.lastname, a.firstname, a.id

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.