select serviceid,area,ctype,sum(remain) as remain,sum(allfee) as allfee,statfortime from wap_nzstat_fee where company in(20,22,35) group by ctype,serviceid,statfortime with cube order by serviceid,statfortime,allfee;好像是这样