คำนวณจำนวนครั้งที่ผู้ป่วย 15821 เข้ารับการตรวจในโรงพยาบาลครั้งแรก ไม่จำเป็นต้องใช้ตารางทั้งหมด
calculate the number of times that patient 15821 took po intake on the first hospital visit.It is not neccessary to use all the tables.
 d_icd_diagnoses:  row_id [ number]  icd9_code [ text]  short_title [ text]  long_title [ text] 
SELECT COUNT(*) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15821 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'po intake' AND d_items.linksto = 'inputevents_cv')