มือใหม่ครับหัดลองเขียน ไม่รู้ว่าตรงกับที่ขอหรือป่าว
select a.hn,a.refer_date,a.hospcode,a.refer_type,a.pttype,concat(pname," ",fname," ",lname),a.pdx,c.name,d.hosptype,d.name
,e.refer_type_name,a.with_ambulance,a.with_nurse
from referout a
left outer join patient b on b.hn=a.hn
left outer join icd101 c on c.code=a.pdx
left outer join hospcode d on d.hospcode=a.hospcode
left outer join refer_type e on e.refer_type=a.refer_type
where c.code in("r074","i200","i201","i209")
and refer_date between "2008/11/01" and "2008/11/30"