select v.vn,v.income
,sum(if(o.paidst=00,o.sum_price,0)) 'Paidst00'
,sum(if(o.paidst=01,o.sum_price,0)) 'Paidst01'
,sum(if(o.paidst=02,o.sum_price,0)) 'Paidst02'
,sum(if(o.paidst=03,o.sum_price,0)) 'Paidst03'
,sum(if(o.paidst=04,o.sum_price,0)) 'Paidst04'
from vn_stat v
left join opitemrece o on v.vn=o.vn
where v.vstdate between '2012-1-1' and '2012-1-1'
group by v.vn
ประมาณนี้มั๊ย