直接生成统计表不就好了?
http://www.foxtable.com/webhelp/scr/0158.htm
设置汇总模式也很好
http://www.foxtable.com/webhelp/scr/00144.htm