修改下SQL语句select 名称,编号,sum(sl) as 数量,sum(je) as 金额 from shop_action where datediff('d',fhsj,"&day2&")>=0 and datediff('d',"&day1&",fhsj)<=0 and bookid="&rs("bookid")group by 名称,编号*说明名称,编号,这些字段换成你数据表实际的字段名称汇总就在语句里面实现,然后页面在循环输出即可