วอร์ดแรกสำหรับผู้ป่วย 162 เมื่อ 2 ปีที่แล้วคืออะไร?ไม่จำเป็นต้องใช้ทุกตาราง
what is the first ward for patient 162 since 2 years ago?It is not neccessary to use all the tables.
 chartevents:  row_id [ number]  subject_id [ number]  hadm_id [ number]  icustay_id [ number]  itemid [ number]  charttime [ time]  valuenum [ number]  valueuom [ text] 
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 162) AND NOT transfers.wardid IS NULL AND DATETIME(transfers.intime) >= DATETIME(CURRENT_TIME(), '-2 year') ORDER BY transfers.intime LIMIT 1