OPD
select pttype, spclty, sum(inc07), sum(inc08)
from vn_stat
where vstdate between "2011-01-01" and "2011-01-31"
group by pttype, spclty
IPD
select pttype, ward, sum(inc07), sum(inc08)
from an_stat
where dchdate between "2011-01-01" and "2011-01-31"
group by pttype, ward