Revision [35]

This is an old revision of ActivePatientsWhoHaveTurned18DuringTreatment made by admin on 2008-10-24 11:01:29.
 

Active Patients Who Have Turned 18 During Treatment


Back to Query Directory

SELECT
COALESCE(b.provcode,'None') AS "Primary Prov",
a.lastname,
a.firstname,
a.ID,
DATEDIFF(year,DOB,intakedate) AS "Age At Intake",
DATEDIFF(year,DOB,current date) AS "Age Now"
FROM
patients a
JOIN providers b ON a.providernum = b.providernum
WHERE
flag = 0 active patient
AND dischargedate IS NULL
no discharge date has been entered
AND "Age At Intake" < 18
AND "Age Now" >= 18
ORDER BY "Primary Prov", a.lastname, a.firstname, a.id


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