select a.pdx,i.name as codename,a.dx0,i0.name as dx0name,
a.dx1,i1.name as dx1name,a.dx2,i2.name as dx2name,a.dx3,i3.name as dx3name,a.dx4,i4.name as dx4name,a.dx5,i5.name as dx5name
from vn_stat a
left outer join patient pt on a.hn = pt.hn
left outer join icd101 i on a.pdx = i.code
left outer join icd101 i0 on a.dx0 = i0.code
left outer join icd101 i1 on a.dx1 = i1.code
left outer join icd101 i2 on a.dx2 = i2.code
left outer join icd101 i3 on a.dx3 = i3.code
left outer join icd101 i4 on a.dx4 = i4.code
left outer join icd101 i5 on a.dx5 = i5.code
where a.vstdate between "2010-10-01" and "2010-10-31"