instruction: what was the name of the drug that patient 005-77687 was prescribed in the same hospital encounter after getting diagnosed with drug overdose- general - with decreased mental status since 08/2105?
response: SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-77687') AND diagnosis.diagnosisname = 'drug overdose- general - with decreased mental status' AND STRFTIME('%y-%m', diagnosis.diagnosistime) >= '2105-08') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-77687') AND STRFTIME('%y-%m', medication.drugstarttime) >= '2105-08') AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid