ปีนี้ตรวจพบผู้ป่วยโรคอ้วน-ป่วยกี่ราย และใครไม่กลับมาโรงพยาบาลภายใน 2 เดือนในปีนี้?ไม่จำเป็นต้องใช้โต๊ะทั้งหมด
how many patients have been diagnosed with obesity - morbid and who did not return to the hospital within 2 months this year?It is not neccessary to use all the tables.
 diagnosis:  diagnosisid [ number]  patientunitstayid [ number]  diagnosisname [ text]  diagnosistime [ time]  icd9code [ text] 
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'obesity - morbid' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'obesity - morbid' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid WHERE t2.diagnosistime < patient.hospitaladmittime AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND DATETIME(patient.hospitaladmittime) BETWEEN DATETIME(t2.diagnosistime) AND DATETIME(t2.diagnosistime, '+2 month'))