คำนวณความแตกต่างระหว่างเอาท์พุตรวมของผู้ป่วย 010-1155 และอินพุทรวมในการนัดตรวจไอซียูครั้งล่าสุด ไม่จำเป็นต้องใช้ตารางทั้งหมด
calculate the difference between patient 010-1155's total output and the total input on the last icu visit.It is not neccessary to use all the tables.
 cost:  costid [ number]  uniquepid [ text]  patienthealthsystemstayid [ number]  eventtype [ text]  eventid [ number]  chargetime [ time]  cost [ number] 
SELECT (SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-1155') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND intakeoutput.cellpath LIKE '%intake%') - (SELECT SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-1155') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND intakeoutput.cellpath LIKE '%output%')