Count Of Patients For An Age Range


Back to Query Directory

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.

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



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