การทดสอบในห้องปฏิบัติการสามครั้งที่พบบ่อยที่สุดที่ผู้ป่วยได้รับในเดือนเดียวกันหลังจากได้รับการผ่าตัดท่อทรวงอกออกในปีที่แล้วคืออะไร? ไม่จำเป็นที่จะต้องใช้ตารางทั้งหมด
what were the three most frequent lab tests that patients had in the same month after receiving a removal of thoracostomy tube procedure during the previous year?It is not neccessary to use all the tables.
 treatment:  treatmentid [ number]  patientunitstayid [ number]  treatmentname [ text]  treatmenttime [ time] 
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'removal of thoracostomy tube' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, lab.labname, lab.labresulttime FROM lab JOIN patient ON lab.patientunitstayid = patient.patientunitstayid WHERE DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.treatmenttime < t2.labresulttime AND DATETIME(t1.treatmenttime, 'start of month') = DATETIME(t2.labresulttime, 'start of month') GROUP BY t2.labname) AS t3 WHERE t3.c1 <= 3