นับจำนวนผู้ป่วยที่ได้รับวิตามินเคภายใน 2 เดือน หลังจากได้รับการวินิจฉัย จนถึง 3 ปีที่แล้ว มีกระดูกหัก-ปลายแขนซ้าย ไม่จำเป็นต้องใช้ทุกตาราง
count the number of patients who received vitamin k within 2 months after being diagnosed until 3 years ago with bone fracture(s) - left lower extremity.It is not neccessary to use all the tables.
 patient:  uniquepid [ text]  patienthealthsystemstayid [ number]  patientunitstayid [ number]  gender [ text]  age [ text]  ethnicity [ text]  hospitalid [ number]  wardid [ number]  admissionheight [ number]  admissionweight [ number]  dischargeweight [ number]  hospitaladmittime [ time]  hospitaladmitsource [ text]  unitadmittime [ time]  unitdischargetime [ time]  hospitaldischargetime [ time]  hospitaldischargestatus [ text] 
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'bone fracture(s) - left lower extremity' AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'vitamin k' AND DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-3 year')) AS t2 WHERE t1.diagnosistime < t2.treatmenttime AND DATETIME(t2.treatmenttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month')