when was the last time that patient 26817 was prescribed medication when they visited the hospital first time?
select prescriptions.startdate from prescriptions where prescriptions.hadm_id in ( select admissions.hadm_id from admissions where admissions.subject_id = 26817 and admissions.dischtime is not null order by admissions.admittime asc limit 1 ) order by prescriptions.startdate desc limit 1