select v.hn,concat(p.pname,p.fname,' ',p.lname) as namept
,min(v.vstdate) as first_in_month,count(v.hn) as amount
from vn_stat v
left join ovstdiag o on v.vn=o.vn
left join patient p on v.hn=p.hn
where v.vstdate between '2009-1-1' and '2009-1-31'
and o.icd10 between 'F129' and 'F1296'
group by v.vn
ประมาณนี้รึป่าว?