select FORMDATE,DEPTNO,VIPNO,CUSTNAME,POSHEAD,POSBODY,COUNTERNO,SPC0,sum(ARS) as SARS,sum(COSTS) as SCOST,sum(CASH+VISA) as SPAYED,sum(DISMONEY) as SDISMONEY from DP000 where FORMDATE >'20161231' and ISCONFIRM='Y' group by FORMDATE,DEPTNO,VIPNO,CUSTNAME,POSHEAD,POSBODY,COUNTERNO,SPC0
