ปริมาณแมกนีเซียมเฉลี่ยต่อวันของผู้ป่วย 23070 ในปีนี้คือเท่าไร? ไม่จำเป็นต้องใช้ตารางทั้งหมด
what is the daily average amount of magnesium patient 23070 has in this year?It is not neccessary to use all the tables.
 procedures_icd:  row_id [ number]  subject_id [ number]  hadm_id [ number]  icd9_code [ text]  charttime [ time] 
SELECT AVG(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 23070) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'magnesium') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY STRFTIME('%y-%m-%d', labevents.charttime)