select v.hn, concat(p.pname,p.fname,' ',p.lname) as ptname,
concat(p.addrpart," หมู่ ",p.moopart," ต.",t3.name," อ.",t2.name," จ.",t1.name) as fulladdressname,
count(v.vn)
from vn_stat v
left outer join patient p on p.hn=v.hn
left outer join thaiaddress t1 on t1.chwpart=p.chwpart
and t1.amppart="00" and t1.tmbpart="00"
left outer join thaiaddress t2 on t2.chwpart=p.chwpart
and t2.amppart=p.amppart and t2.tmbpart="00"
left outer join thaiaddress t3 on t3.chwpart=p.chwpart
and t3.amppart=p.amppart and t3.tmbpart=p.tmbpart
where v.vstdate between '2009-10-01' and '2010-08-13'
group by v.hn
order by count(v.vn) desc
limit 900
( ระวัง Server แฮงค์น่ะ )