Count Of Patients For An Age Range

The following will give you a count of patients with activity in calendary year 2006 who were between 13 and 19 on the last day of 2006.

  COUNT(DISTINCT a.ptnum) AS "numpts"
  sos.journal a
  JOIN sos.patients b ON a.ptnum = b.ptnum
  trantype = 's'
  AND amount > 0
  AND trandate BETWEEN '2006-01-01' AND '2006-12-31'
  AND sos.AgeInYears(dob,'2006-12-31') BETWEEN 13 AND 19

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.