แตกต่างยังไงกับ code นี้คับ
select count(vn.pdx) as pdxx ,count(distinct (vn.hn)) as sp1,vn.pdx,icd.name
from ovst ovst
left outer join vn_stat vn on vn.vn=ovst.vn
left outer join patient pt on pt.hn=vn.hn
left outer join icd101 icd on icd.code=vn.pdx
where vn.vstdate between "2011-11-01" and "2012-06-30"
and vn.pdx is not null and vn.pdx<>""
and ovst.main_dep in ("000","001","002","003","004","005","006","007","023","045")
group by vn.pdx
order by pdxx desc