select d.icd10,d.hn ,p.pname,p.fname,p.lname ,d.vstdate, (select dt.name from opitemrece as op left outer join drugitems as dt on dt.icode = op.icode where op.icode in ('1000028','1000030','1000032','1530161') and vn= d.vn limit 1 ) as drug from ovstdiag as d left OUTER join person as p on p.patient_hn = d.hn where d.vstdate BETWEEN "2017-09-01" and "2017-09-30" and icd10 in ("J00","J010" "J011","J012","J013","J014","J018","J019","J020","J029", "J030","J038","J039","J040","J041","J042","J050","J051", "J060","J068","J069","J100","J111","J200","J201","J202", "J219","H650","H651","H659","H660","H664","H669", "H670","H671","H678","H720","H721","H728","H729" )