ลอง
select vn,hn,an,pttype,income ,
SUM(IF(income="07",sum_price,0)) as xray,
SUM(IF(income="08",sum_price,0)) as lab,
SUM(IF(income="09",sum_price,0)) as ค่าห้อง,
SUM(IF(income="10",sum_price,0)) as ค่ายา,
from opitemrece
where pttype in (89) and hn ='000279709'
and vstdate between '2012-08-30' and '2012-09-04'
and an <> '0'