มีผู้ป่วยกี่รายที่ได้รับ cont inv mec ven <96 ชั่วโมงหลังจากขั้นตอนการใส่ท่อช่วยหายใจในปีที่แล้วระหว่างการเยี่ยมโรงพยาบาลครั้งเดียวกัน? ไม่จำเป็นที่จะต้องใช้โต๊ะทั้งหมด
how many patients received a cont inv mec ven <96 hrs after the procedure of the insert endotracheal tube last year during the same hospital visit?It is not neccessary to use all the tables.
 d_icd_procedures:  row_id [ number]  icd9_code [ text]  short_title [ text]  long_title [ text] 
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert endotracheal tube') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cont inv mec ven <96 hrs') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND t1.hadm_id = t2.hadm_id