หรือ
select count(v.vn) as cc,count(distinct(v.hn)) as bb,v.spclty ,s.name ,o.main_dep,k.department from vn_stat v
left outer join ovst o on o.vn=v.vn
left outer join spclty s on s.spclty=v.spclty
left outer join kskdepartment k on k.depcode=o.main_dep
where v.vstdate between "2011-xx-xx" and "2011-yy-yy"
group by o.main_dep,v.spclty
order by o.main_dep